summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-10-25 17:29:47 (GMT)
committerBrad King <brad.king@kitware.com>2007-10-25 17:29:47 (GMT)
commitc4ffd00711466e65308ddaa1c568e12906dcc14d (patch)
treed39d3f651672c99a3186e868b5da9fd789d22218 /Source
parent2d1bcf806f5a0bbff1b13953f38ec5ab79fcd0e1 (diff)
downloadCMake-c4ffd00711466e65308ddaa1c568e12906dcc14d.zip
CMake-c4ffd00711466e65308ddaa1c568e12906dcc14d.tar.gz
CMake-c4ffd00711466e65308ddaa1c568e12906dcc14d.tar.bz2
BUG: Fix bug#5590. When converting a relative path between two full paths on different windows drive letters do not create a ../../d:/foo/bar path and just return the full path to the destination.
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/SystemTools.cxx19
1 files changed, 6 insertions, 13 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index c2ded8c..064b467 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -2753,22 +2753,15 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
sameCount++;
}
-#if 0
- // NOTE: We did this at one time to prevent relative paths to the
- // compiler from looking like "../../../../../../../usr/bin/gcc".
- // Now however relative paths are only computed for destinations
- // inside the build tree so this is not a problem. This is now a
- // general-purpose method and should not have this hack. I'm
- // leaving it in place in case removing it causes a problem so it is
- // easy to restore:
- //
- // If there is nothing in common but the root directory, then just
- // return the full path.
- if(sameCount <= 1)
+ // If there is nothing in common at all then just return the full
+ // path. This is the case only on windows when the paths have
+ // different drive letters. On unix two full paths always at least
+ // have the root "/" in common so we will return a relative path
+ // that passes through the root directory.
+ if(sameCount == 0)
{
return remote;
}
-#endif
// for each entry that is not common in the local path
// add a ../ to the finalpath array, this gets us out of the local