Changeset 437 for CMT


Ignore:
Timestamp:
Feb 2, 2008, 7:39:21 AM (16 years ago)
Author:
rybkin
Message:

See C.L. 342

Location:
CMT/HEAD
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r436 r437  
     12008-02-02    <rybkin@lal.in2p3.fr> 342
     2
     3        * source/cmt_project.h: Optimise the use of realpath_
     4        * source/cmt_project.cxx: idem
     5        * source/cmt_use.cxx: idem
     6       
    172008-01-31    <rybkin@lal.in2p3.fr> 341
    28
  • CMT/HEAD/source/cmt_project.cxx

    r435 r437  
    272272  // In case there are symlinks
    273273  cmt_string here_real, pwd_real;
     274  //cerr << "realpath_: create_project" << endl;
    274275  if (CmtSystem::realpath_ (here, here_real) && CmtSystem::realpath_ (pwd, pwd_real))
    275276    {
     
    560561
    561562  project->set_cmtpath (compressed_path);
     563  project->set_cmtpath_real (pwd_real);
    562564  project->set_cmtpath_pwd (pwd);
    563565  project->set_cmtpath_source (source);
     
    778780
    779781      if (p.m_cmtpath == compressed_path) return (&p);
     782      if (p.m_cmtpath_real == compressed_path) return (&p);
    780783      if (p.m_cmtpath_pwd == compressed_path) return (&p);
    781784    }
     
    801804      Project& p = Projects[i];
    802805
    803       if (here.find (p.m_cmtpath_pwd) == 0)
    804         {
    805           result = &p;
    806         }
    807 
    808       // In case there are symlinks
    809       //      if (here.find (p.m_cmtpath) == 0)
    810       cmt_string p_real;
    811       CmtSystem::realpath_ (p.m_cmtpath, p_real);
    812       if (here_real.find (p_real) == 0)
     806//       if (here.find (p.m_cmtpath_pwd) == 0)
     807//      {
     808//        result = &p;
     809//      }
     810
     811//      if (here.find (p.m_cmtpath) == 0)
     812      if (here_real.find (p.m_cmtpath_real) == 0)
    813813        {
    814814          result = &p;
     
    10721072  const cmt_string pwd = CmtSystem::pwd ();
    10731073
     1074  // In case there are symlinks
     1075  cmt_string path_real;
     1076  //cerr << "realpath_: find_in_cmt_paths" << endl;
     1077  CmtSystem::realpath_ (path, path_real);
     1078
    10741079  static ProjectVector& Projects = projects ();
    10751080
     
    10791084
    10801085      const cmt_string& p = project.m_cmtpath;
     1086      const cmt_string& p_real = project.m_cmtpath_real;
    10811087      const cmt_string& w = project.m_cmtpath_pwd;
    10821088      const cmt_string& s = project.m_cmtpath_source;
     
    10911097//          }
    10921098
    1093           // In case there are symlinks
    1094           cmt_string p_real, path_real;
    1095           if (CmtSystem::realpath_ (p, p_real) && CmtSystem::realpath_ (path, path_real))
    1096             {
    1097               if (path_real.find (p_real) != cmt_string::npos) return (p);
     1099          if (path_real.find (p_real) != cmt_string::npos)
     1100            {
     1101              return (p);
    10981102            }
    10991103
     
    12681272
    12691273//----------------------------------------------------------
     1274const cmt_string& Project::get_cmtpath_real () const
     1275{
     1276  return (m_cmtpath_real);
     1277}
     1278
     1279//----------------------------------------------------------
    12701280const cmt_string& Project::get_cmtpath_pwd () const
    12711281{
     
    13301340
    13311341//----------------------------------------------------------
     1342void Project::set_cmtpath_real (const cmt_string& path)
     1343{
     1344  m_cmtpath_real = path;
     1345}
     1346
     1347//----------------------------------------------------------
    13321348void Project::set_cmtpath_pwd (const cmt_string& path)
    13331349{
     
    13471363  m_release = "";
    13481364  m_cmtpath = "";
     1365  m_cmtpath_real = "";
    13491366  m_cmtpath_pwd    = "";
    13501367  m_cmtpath_source = "";
     
    17181735  m_name = other.m_name;
    17191736  m_cmtpath = other.m_cmtpath;
     1737  m_cmtpath_real = other.m_cmtpath_real;
    17201738  m_cmtpath_pwd = other.m_cmtpath_pwd;
    17211739  m_cmtpath_source = other.m_cmtpath_source;
     
    17431761  bool is_current = false;
    17441762
    1745   cmt_string here = CmtSystem::pwd ();
    1746 
    1747   if (here.find (m_cmtpath) == 0)
     1763  //  cmt_string here = CmtSystem::pwd ();
     1764  // In case there are symlinks
     1765  cmt_string here_real;
     1766  CmtSystem::realpath_ (CmtSystem::pwd (), here_real);
     1767
     1768  //  if (here.find (m_cmtpath) == 0)
     1769  if (here_real.find (m_cmtpath_real) == 0)
    17481770    {
    17491771      if (m_cmtpath_source != "default path")
  • CMT/HEAD/source/cmt_project.h

    r330 r437  
    136136  const cmt_string& get_container_version () const;
    137137  const cmt_string& get_cmtpath () const;
     138  const cmt_string& get_cmtpath_real () const;
    138139  const cmt_string& get_cmtpath_pwd () const;
    139140  const cmt_string& get_cmtpath_source () const;
     
    151152  void set_container_version (const cmt_string& version);
    152153  void set_cmtpath (const cmt_string& path);
     154  void set_cmtpath_real (const cmt_string& path);
    153155  void set_cmtpath_pwd (const cmt_string& path);
    154156  void set_cmtpath_source (const cmt_string& source);
     
    210212
    211213  cmt_string m_cmtpath;
     214  cmt_string m_cmtpath_real;
    212215  cmt_string m_cmtpath_pwd;
    213216  cmt_string m_cmtpath_source;
  • CMT/HEAD/source/cmt_use.cxx

    r435 r437  
    29022902
    29032903  cmtpath = Project::find_in_cmt_paths (real_path);
    2904 
    2905   if (cmtpath != "")
     2904  Project* p = Project::find_by_cmtpath (cmtpath);
     2905
     2906  //  if (cmtpath != "")
     2907  if (p != 0)
    29062908    {
    29072909      CmtSystem::compress_path (cmtpath);
     
    29132915      //      offset = real_path;
    29142916      //      offset.replace (cmtpath, empty_string);
     2917      //cerr << "realpath_: get_cmtpath_and_offset" << endl;
    29152918      CmtSystem::realpath_ (real_path, offset);
    2916       cmt_string cmtpath_real;
    2917       CmtSystem::realpath_ (cmtpath, cmtpath_real);
    2918       offset.replace (cmtpath_real, empty_string);
     2919      offset.replace (p->get_cmtpath_real (), empty_string);
    29192920
    29202921      /**
Note: See TracChangeset for help on using the changeset viewer.