Changeset 435


Ignore:
Timestamp:
Jan 25, 2008, 1:57:34 PM (16 years ago)
Author:
rybkin
Message:

See C.L. 340

Location:
CMT/HEAD
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r434 r435  
     12008-01-25    <rybkin@lal.in2p3.fr> 340
     2
     3        * source/cmt_system.h: Improve the handling of symlinks in the paths
     4        * source/cmt_system.cxx: idem
     5        * source/cmt_use.cxx: idem
     6        * source/cmt_project.cxx: idem
     7        * source/cmt_parser.cxx: Comment out a duplicate piece of code
     8       
    192008-01-18    <rybkin@lal.in2p3.fr> 339
    210
  • CMT/HEAD/source/cmt_parser.cxx

    r431 r435  
    923923              if (structuring_style == with_version_directory)
    924924                {
    925                   cerr << "#CMT> warning: " << up_branch << " is not correct version syntax. Assuming it is package name" << endl;
     925                  cerr << "#CMT> Warning: " << up_branch << " is not correct version syntax. Assuming it is package name" << endl;
    926926                }
    927927              // No version descriptor
     
    75897589  cmt_string pwd = CmtSystem::pwd ();
    75907590
     7591  /**
     7592   * This is already done in
     7593   void Cmt::configure_current_package ()
     7594
    75917595  if (CmtSystem::test_file ("../cmt/requirements")) Me.m_current_style = cmt_style;
    75927596  else if (CmtSystem::test_file ("../mgr/requirements")) Me.m_current_style = mgr_style;
     
    76027606      }
    76037607  }
     7608  */
    76047609
    76057610  // Prepare computation of the best form for relative path from current directory
  • CMT/HEAD/source/cmt_project.cxx

    r411 r435  
    268268  // Figure out if this is the current project
    269269  //
    270   if (here.find (pwd) == 0) is_current = true;
     270  //  if (here.find (pwd) == 0) is_current = true;
     271
     272  // In case there are symlinks
     273  cmt_string here_real, pwd_real;
     274  if (CmtSystem::realpath_ (here, here_real) && CmtSystem::realpath_ (pwd, pwd_real))
     275    {
     276      if (here_real.find (pwd_real) == 0) is_current = true;
     277    }
    271278
    272279  cmt_string text;
     
    782789  cmt_string here = CmtSystem::pwd ();
    783790
     791  // In case there are symlinks
     792  cmt_string here_real;
     793  CmtSystem::realpath_ (here, here_real);
     794
    784795  static ProjectVector& Projects = projects ();
    785796
     
    795806        }
    796807
    797       if (here.find (p.m_cmtpath) == 0)
     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)
    798813        {
    799814          result = &p;
     
    10711086      if (CmtSystem::test_directory (p))
    10721087        {
    1073           if (path.find (p) != cmt_string::npos)
    1074             {
    1075               return (p);
     1088//        if (path.find (p) != cmt_string::npos)
     1089//          {
     1090//            return (p);
     1091//          }
     1092
     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);
    10761098            }
    10771099
  • CMT/HEAD/source/cmt_system.cxx

    r411 r435  
    252252      CmtSystem::cd (path);
    253253      result = CmtSystem::pwd ();
     254      CmtSystem::cd (here);
     255      return true;
     256    }
     257  return false;
     258}
     259
     260//--------------------------------------------------
     261bool CmtSystem::realpath_ (const cmt_string& path, cmt_string& result)
     262{
     263  if  (test_directory(path))
     264    {
     265      cmt_string here = CmtSystem::pwd ();
     266      CmtSystem::cd (path);
     267      //
     268      char buffer[256] = "";
     269      char* ptr = 0;
     270      ptr = getcwd (buffer, sizeof (buffer));
     271      const char* t = &buffer[0];
     272      result = t;
     273      //      cerr << "realpath_> path: " << path << " result: " << result << endl;
     274      //
    254275      CmtSystem::cd (here);
    255276      return true;
  • CMT/HEAD/source/cmt_system.h

    r411 r435  
    4040  // Resolve symbolic links in a path.
    4141  static bool realpath (const cmt_string& path, cmt_string& result);
     42  // Currently the above does not resolve symbolic links in a path.
     43  static bool realpath_ (const cmt_string& path, cmt_string& result);
    4244
    4345  static void dirname (const cmt_string& file_name, cmt_string& result);
  • CMT/HEAD/source/cmt_use.cxx

    r400 r435  
    29102910      static const cmt_string fs = CmtSystem::file_separator ();
    29112911     
    2912       offset = real_path;
    2913       offset.replace (cmtpath, empty_string);
     2912      // In case there are symlinks
     2913      //      offset = real_path;
     2914      //      offset.replace (cmtpath, empty_string);
     2915      CmtSystem::realpath_ (real_path, offset);
     2916      cmt_string cmtpath_real;
     2917      CmtSystem::realpath_ (cmtpath, cmtpath_real);
     2918      offset.replace (cmtpath_real, empty_string);
    29142919
    29152920      /**
Note: See TracChangeset for help on using the changeset viewer.