Changeset 652 for CMT/HEAD/source/cmt_use.cxx
- Timestamp:
- Nov 5, 2013, 3:40:52 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_use.cxx
r610 r652 1826 1826 m_located = false; 1827 1827 m_package = 0; 1828 m_project = 0; 1828 1829 m_index = -1; 1829 1830 … … 1848 1849 m_package = 0; 1849 1850 } 1851 m_project = 0; 1850 1852 1851 1853 version = ""; … … 1923 1925 1924 1926 //---------------------------------------------------------- 1925 void Use::change_path (const cmt_string& new_path )1927 void Use::change_path (const cmt_string& new_path, const Project* project) 1926 1928 { 1927 1929 // … … 1929 1931 // where this package/version has been found. 1930 1932 // 1933 if (Cmt::get_debug ()) 1934 { 1935 cout << "|Use::change_path> path: " << new_path 1936 << ": project: " << (project ? project->get_cmtpath () : "0") 1937 << ": " << get_info () << endl; 1938 } 1931 1939 1932 1940 real_path = ""; 1933 1941 m_realpath = ""; 1934 1942 1935 if (new_path != "") 1943 m_project = 0; 1944 1945 if (new_path.size () != 0) 1946 // if (new_path != "") 1936 1947 { 1937 1948 if ((path.size () > 0) && … … 1951 1962 if (!CmtSystem::realpath_ (real_path, m_realpath)) 1952 1963 { 1953 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + 1954 real_path + "'"); 1964 CmtError::set (CmtError::file_access_error, 1965 "Cannot compute real path `" + real_path + "': " + 1966 get_info ()); 1955 1967 CmtError::print (); 1956 1968 return; … … 1958 1970 } 1959 1971 1972 if (project) 1973 m_project = project; 1974 1960 1975 m_located = true; 1976 1977 if (Cmt::get_debug ()) 1978 { 1979 cout << "<Use::change_path| real_path: " << real_path 1980 << ": m_project: " << (m_project ? m_project->get_cmtpath () : "0") 1981 << ": " << get_info () << endl; 1982 } 1961 1983 } 1962 1984 … … 2347 2369 } 2348 2370 2349 m_use->change_path (path );2371 m_use->change_path (path, &project); 2350 2372 2351 2373 m_found = true; … … 2355 2377 else if (m_use->alternate_versions.size () > 0) 2356 2378 { 2357 if (m_use->select_alternate ( ))2379 if (m_use->select_alternate (&project)) 2358 2380 { 2359 2381 if (Cmt::get_debug ()) … … 2448 2470 cout << "move_to2> " << expanded_path << endl; 2449 2471 } 2450 2451 2472 change_path (here); 2452 2453 2473 return (true); 2454 2474 } … … 2461 2481 cout << "move_to5> " << real_path << endl; 2462 2482 } 2463 2464 2483 return (true); 2465 2484 } 2466 2485 } 2486 2487 if (!CmtSystem::cd (here)) 2488 { 2489 CmtError::set (CmtError::file_access_error, here); 2490 } 2467 2491 return (false); 2468 2492 // } … … 2482 2506 2483 2507 //---------------------------------------------------------- 2484 bool Use::select_alternate ( )2508 bool Use::select_alternate (const Project* project) 2485 2509 { 2486 2510 int i; … … 2567 2591 } 2568 2592 2569 change_path (alternate_paths[selected_index] );2593 change_path (alternate_paths[selected_index], project); 2570 2594 return (true); 2571 2595 } … … 3568 3592 offset = ""; 3569 3593 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); 3575 3594 const Project* p (0); 3595 if (m_project) 3596 { 3597 p = m_project; 3598 cmtpath = p->get_cmtpath (); 3599 } 3600 else 3601 { 3602 cmtpath = m_realpath.size () 3603 ? Project::find_in_cmt_paths (m_realpath, true) 3604 : Project::find_in_cmt_paths (real_path) 3605 ; 3606 p = Project::find_by_cmtpath (cmtpath); 3607 // const Project* p = Project::find_by_cmtpath (cmtpath); 3608 } 3576 3609 // if (cmtpath != "") 3577 3610 if (p != 0) … … 3590 3623 else if (!CmtSystem::realpath_ (real_path, offset)) 3591 3624 { 3592 CmtError::set (CmtError::file_access_error, "Cannot compute real path `" + 3593 real_path + "'"); 3625 CmtError::set (CmtError::file_access_error, 3626 "Cannot compute real path `" + real_path + "': " + 3627 get_info ()); 3594 3628 CmtError::print (); 3595 3629 return; … … 3705 3739 buffer += "\n"; 3706 3740 3707 if (located ()) 3741 if (m_located) 3742 // if (located ()) 3708 3743 { 3709 3744 buffer += "macro "; … … 3725 3760 buffer += package_name; 3726 3761 } 3727 // if (style != no_version_style)3728 3762 if (structuring_style == with_version_directory) 3729 3763 { … … 3764 3798 buffer += "\n"; 3765 3799 3766 Project* p = Project::find_by_cmtpath (cmtpath); 3800 const Project* p (m_project); 3801 if (!p) 3802 p = Project::find_by_cmtpath (cmtpath); 3767 3803 3768 3804 buffer += "macro "; … … 4829 4865 4830 4866 return (is_in_path); 4831 }4832 4833 //----------------------------------------------------------4834 bool Use::located () const4835 {4836 return (m_located);4837 4867 } 4838 4868 … … 5736 5766 5737 5767 //---------------------------------------------------------- 5738 Project* Use::get_project () 5768 const Project* Use::get_project () const 5739 5769 { 5770 if (m_project) 5771 return m_project; 5772 5773 cmt_string cmtpath = m_realpath.size () 5774 ? Project::find_in_cmt_paths (m_realpath, true) 5775 : Project::find_in_cmt_paths (real_path) 5776 ; 5777 return Project::find_by_cmtpath (cmtpath); 5778 /* 5740 5779 Project* p; 5741 5780 cmt_string cmtpath = ""; … … 5744 5783 p = Project::find_by_cmtpath (cmtpath); 5745 5784 return p; 5785 */ 5746 5786 } 5747 5787
Note: See TracChangeset
for help on using the changeset viewer.