- Timestamp:
- Apr 5, 2012, 1:43:26 PM (12 years ago)
- Location:
- CMT/HEAD
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/ChangeLog
r607 r608 1 2012-04-05 <rybkin@lal.in2p3.fr> 483 2 3 * source/cmt_project.h: In class Project function find_in_cmt_paths, add 4 second boolean parameter to specify whether first argument is real path 5 * source/cmt_project.cxx: In class Project, in function find_in_cmt_paths, 6 do not call CmtSystem::realpath_ if boolean parameter is true, in function 7 order_all, make use of m_realpath from class Use 8 * source/cmt_use.h: In class Use, introduce member m_realpath to hold 9 canonicalized absolute real_path, and member function get_realpath 10 * source/cmt_use.cxx: In class Use, in function change_path, calculate 11 m_realpath, in functions get_cmtpath_and_offset and get_strategy, make use 12 of m_realpath when calling Project::find_in_cmt_paths 13 * source/cmt_symbol.cxx: In find_path_entry helper function, introduce 14 static cache of real paths in order to optimise CmtSystem::realpath_ usage 15 1 16 2012-04-03 <rybkin@lal.in2p3.fr> 482 2 17 -
CMT/HEAD/source/cmt_project.cxx
r607 r608 987 987 988 988 Use& use = Use::current(); 989 cmt_string current_path (Cmt::get_current_dir ()); 989 cmt_string current_path; 990 cmt_string current_path_real; 990 991 if (use.located ()) 991 992 { 992 current_path = use.real_path; 993 CmtMessage::verbose ("Using current use real_path `" + current_path + "'"); 994 } 995 996 cmt_string current_path_real; 997 if (!CmtSystem::realpath_ (current_path, current_path_real)) 993 current_path_real = use.get_realpath (); 994 if (current_path_real.size ()) 995 CmtMessage::verbose ("Using current use realpath `" + current_path_real + "'"); 996 else 997 { 998 current_path = use.real_path; 999 CmtMessage::verbose ("Using current use real_path `" + current_path + "'"); 1000 } 1001 } 1002 else 1003 current_path = Cmt::get_current_dir (); 1004 1005 if (0 == current_path_real.size () && 1006 !CmtSystem::realpath_ (current_path, current_path_real)) 998 1007 { 999 1008 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + … … 1650 1659 1651 1660 //---------------------------------------------------------- 1652 cmt_string Project::find_in_cmt_paths (const cmt_string& path )1661 cmt_string Project::find_in_cmt_paths (const cmt_string& path, bool realpath) 1653 1662 { 1654 1663 //const cmt_string pwd = CmtSystem::pwd (); … … 1657 1666 cmt_string path_real; 1658 1667 //cerr << "realpath_: find_in_cmt_paths" << endl; 1659 if (!CmtSystem::realpath_ (path, path_real)) 1668 if (realpath) 1669 path_real = path; 1670 else if (!CmtSystem::realpath_ (path, path_real)) 1660 1671 return (""); 1661 1672 -
CMT/HEAD/source/cmt_project.h
r581 r608 127 127 static void scan_paths_for_package (PathScanner& scanner, const cmt_string& name); 128 128 129 static cmt_string find_in_cmt_paths (const cmt_string& path );129 static cmt_string find_in_cmt_paths (const cmt_string& path, bool realpath = false); 130 130 131 131 static void fill_cmtpaths (cmt_string& buffer); -
CMT/HEAD/source/cmt_symbol.cxx
r607 r608 2223 2223 { 2224 2224 static const cmt_string path_separator = CmtSystem::path_separator (); 2225 2226 // cmt_string here = CmtSystem::pwd (); 2227 cmt_string rvalue = value; 2228 2229 /* 2230 if (CmtSystem::cd (value)) 2231 { 2232 rvalue = CmtSystem::pwd (); 2233 } 2234 else 2235 */ 2236 if (!CmtSystem::realpath_ (value, rvalue)) 2237 { 2238 CmtSystem::compress_path (rvalue); 2225 static cmt_vmap <cmt_string, cmt_string> realpaths; 2226 2227 cmt_string rvalue; 2228 const cmt_string * prvalue; 2229 2230 if (!(prvalue = realpaths.find (value))) 2231 { 2232 if (!CmtSystem::realpath_ (value, rvalue)) 2233 { 2234 rvalue = value; 2235 CmtSystem::compress_path (rvalue); 2236 } 2237 prvalue = &rvalue; 2238 realpaths.add (value, rvalue); 2239 // cerr << "realpaths.add: " << value << " , " << rvalue << endl; 2239 2240 } 2240 2241 … … 2247 2248 { 2248 2249 const cmt_string& item = items[i]; 2249 cmt_string ritem = item; 2250 /* 2251 if (CmtSystem::cd (item)) 2250 cmt_string ritem; 2251 const cmt_string * pritem; 2252 2253 if (!(pritem = realpaths.find (item))) 2252 2254 { 2253 ritem = CmtSystem::pwd (); 2255 if (!CmtSystem::realpath_ (item, ritem)) 2256 { 2257 ritem = item; 2258 CmtSystem::compress_path (ritem); 2259 } 2260 pritem = &ritem; 2261 realpaths.add (item, ritem); 2262 // cerr << "realpaths.add: " << item << " , " << ritem << endl; 2254 2263 } 2255 else 2256 */ 2257 if (!CmtSystem::realpath_ (item, ritem)) 2258 { 2259 CmtSystem::compress_path (ritem); 2260 } 2261 2262 if (ritem == rvalue) 2264 if (*pritem == *prvalue) 2263 2265 { 2264 2266 found = true; … … 2267 2269 } 2268 2270 2269 // CmtSystem::cd (here);2270 2271 return (found); 2271 2272 } -
CMT/HEAD/source/cmt_use.cxx
r607 r608 1853 1853 manager = ""; 1854 1854 real_path = ""; 1855 m_realpath = ""; 1855 1856 1856 1857 prefix = ""; … … 1930 1931 1931 1932 real_path = ""; 1933 m_realpath = ""; 1932 1934 1933 1935 if (new_path != "") … … 1947 1949 1948 1950 CmtSystem::compress_path (real_path); 1951 if (!CmtSystem::realpath_ (real_path, m_realpath)) 1952 { 1953 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + 1954 real_path + "'"); 1955 CmtError::print (); 1956 return; 1957 } 1949 1958 } 1950 1959 … … 3559 3568 offset = ""; 3560 3569 3561 cmtpath = Project::find_in_cmt_paths (real_path); 3562 Project* p = Project::find_by_cmtpath (cmtpath); 3570 cmtpath = m_realpath.size () 3571 ? Project::find_in_cmt_paths (m_realpath, true) 3572 : Project::find_in_cmt_paths (real_path) 3573 ; 3574 const Project* p = Project::find_by_cmtpath (cmtpath); 3563 3575 3564 3576 // if (cmtpath != "") … … 3574 3586 // offset.replace (cmtpath, empty_string); 3575 3587 //cerr << "realpath_: get_cmtpath_and_offset" << endl; 3576 if (!CmtSystem::realpath_ (real_path, offset)) 3588 if (0 != m_realpath.size ()) 3589 offset = m_realpath; 3590 else if (!CmtSystem::realpath_ (real_path, offset)) 3577 3591 { 3578 3592 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + … … 3605 3619 bool Use::get_strategy (const cmt_string& name) const 3606 3620 { 3607 const Project* p = Project::find_by_cmtpath (Project::find_in_cmt_paths (real_path)); 3621 const Project* p = 3622 Project::find_by_cmtpath (m_realpath.size () 3623 ? Project::find_in_cmt_paths (m_realpath, true) 3624 : Project::find_in_cmt_paths (real_path) 3625 ); 3626 // const Project* p = Project::find_by_cmtpath (Project::find_in_cmt_paths (real_path)); 3608 3627 3609 3628 bool strategy; -
CMT/HEAD/source/cmt_use.h
r588 r608 110 110 void get_cmtpath_and_offset (cmt_string& cmtpath, cmt_string& offset) const; 111 111 bool get_strategy (const cmt_string& name) const; 112 inline const cmt_string& get_realpath () const { return m_realpath; } 112 113 113 114 void fill_includes_macro (cmt_string& buffer) const; … … 246 247 247 248 cmt_regexp m_head_version; 249 cmt_string m_realpath; /* canonicalized absolute real_path */ 248 250 249 251 friend class UseProjectAction;
Note: See TracChangeset
for help on using the changeset viewer.