Changeset 463 for CMT


Ignore:
Timestamp:
Jul 18, 2008, 4:17:43 PM (16 years ago)
Author:
rybkin
Message:

See C.L. 364

Location:
CMT/HEAD
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CMT/HEAD/ChangeLog

    r462 r463  
     12008-07-18    <rybkin@lal.in2p3.fr> 364
     2       
     3        * source/cmt_system.cxx: In the CmtSystem::compress_path function, add the
     4        replacement of "/.." with "/" (one cannot walk down past the root), more
     5        careful treatment of some boundary cases
     6        * source/cmt_parser.cxx: Add 2 debug level messages in the function
     7        Cmt::guess_current_project
     8       
    192008-06-25    <rybkin@lal.in2p3.fr> 363
    210       
  • CMT/HEAD/source/cmt_parser.cxx

    r461 r463  
    45654565          if (!CmtSystem::cd (".."))
    45664566            {
     4567              log << "Cannot cd up..." << log_endl;
    45674568              break;
    45684569            }
     
    45704571          if (CmtSystem::pwd () == pwd)
    45714572            {
     4573              log << "Looks the same pwd..." << log_endl;
    45724574              break;
    45734575            }
  • CMT/HEAD/source/cmt_system.cxx

    r459 r463  
    21382138//     xxxx does not contain any macro reference
    21392139//
     2140// Also replace "/.." with "/". One cannot walk down past the root.
    21402141//----------------------------------------------------------
    21412142void CmtSystem::compress_path (cmt_string& dir)
     
    21692170  for (;;)
    21702171    {
     2172      int pos0 (0);
    21712173      int pos1;
    21722174      int pos2;
    21732175      int pos3;
    21742176
    2175       pos1 = dir.find (pattern);
     2177      //pos1 = dir.find (pattern);
     2178      //if (pos1 == cmt_string::npos) break;
     2179
     2180      do
     2181        {
     2182          pos1 = dir.find (pos0, pattern);
     2183          if (pos1 == cmt_string::npos) break;
     2184          pos0 = pos1 + 3;
     2185        }
     2186      while (pos0 < dir.size () && dir[pos0] != file_separator ());
     2187
    21762188      if (pos1 == cmt_string::npos) break;
     2189
     2190      //
     2191      // One cannot walk down past the root: "/.." is the same as "/".
     2192      //
     2193#ifdef WIN32
     2194      if (pos1 == 0)
     2195        {
     2196          dir.erase (pos1, 3);
     2197          if (dir == "")
     2198            dir = file_separator ();
     2199          continue;
     2200        }
     2201      else if (pos1 == 2 && dir[1] == ':')
     2202        {
     2203          dir.erase (pos1, 3);
     2204          if (dir.size () == 2)
     2205            dir += file_separator ();
     2206          continue;
     2207        }
     2208#else
     2209      if (pos1 == 0)
     2210        {
     2211          dir.erase (pos1, 3);
     2212          if (dir == "")
     2213            dir = file_separator ();
     2214          continue;
     2215        }
     2216#endif
    21772217
    21782218      //
     
    22242264            {
    22252265              dir.erase (pos2, pos1 + 3 - pos2);
     2266#ifdef WIN32
     2267              if (dir == "")
     2268                {
     2269                  dir = file_separator ();
     2270                }
     2271              else if (dir.size () == 2 && dir[1] == ':')
     2272                {
     2273                  dir += file_separator ();
     2274                }
     2275#else
     2276              if (dir == "")
     2277                dir = file_separator ();
     2278#endif
    22262279            }
    22272280          else
Note: See TracChangeset for help on using the changeset viewer.