diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2004-05-06 14:29:29 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2004-05-06 14:29:29 (GMT) |
commit | 8d41f97ff65b1aa35a0cd15081f66210ff8b483a (patch) | |
tree | 9a930e60e43405edfbcc64c7af1636a2dfd1ae17 | |
parent | 6c0fb31d5094d9628f3acaac6ef5c76cdc30d660 (diff) | |
download | CMake-8d41f97ff65b1aa35a0cd15081f66210ff8b483a.zip CMake-8d41f97ff65b1aa35a0cd15081f66210ff8b483a.tar.gz CMake-8d41f97ff65b1aa35a0cd15081f66210ff8b483a.tar.bz2 |
BUG: fix collapse full path to handle a file in the root directory
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 7ae6b00..9d92965 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -725,7 +725,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) } // remove any trailing slash - if(path.size() && path[path.size()-1] == '/') + if(path.size() > 1 && path[path.size()-1] == '/') { path = path.substr(0, path.size()-1); } @@ -1364,6 +1364,12 @@ kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative, kwsys_stl::string dir, file; SystemTools::SplitProgramPath(in_relative, dir, file, false); + if(dir.size() == 0 && + in_relative && strlen(in_relative) > 0 && + in_relative[0] == '/') + { + dir = "/"; + } #ifdef _WIN32 // Follow relative path. @@ -1413,7 +1419,10 @@ kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative, kwsys_stl::string newPath = newDir; if(!(file == "")) { - newPath += "/"; + if(!(newDir.size() == 1 && newDir[0] == '/')) + { + newPath += "/"; + } newPath += file; } return newPath; |