summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-10-19 17:02:42 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-10-19 17:02:42 (GMT)
commite9b6e65cbd0cfc522c3118c90467be8cea1ee797 (patch)
treea3ed78d323167f4ffb403b44ec69d244eb16589a /Source
parent429cf9d612f92049ab80e558cbfd17874a724d9b (diff)
downloadCMake-e9b6e65cbd0cfc522c3118c90467be8cea1ee797.zip
CMake-e9b6e65cbd0cfc522c3118c90467be8cea1ee797.tar.gz
CMake-e9b6e65cbd0cfc522c3118c90467be8cea1ee797.tar.bz2
BUG: if the paths share nothing then just return the remote path with no ..
Diffstat (limited to 'Source')
-rw-r--r--Source/cmSystemTools.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 033e5fe..26ebdca 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1221,15 +1221,6 @@ std::string cmSystemTools::RelativePath(const char* local, const char* remote)
cmSystemTools::Error("RelativePath must be passed a full path to remote: ", remote);
}
- // check for driveletter: as the start of the path
- // if not on the same drive then full path to local must be used.
- if(local[0] && local[0] != '/')
- {
- if(remote[0] && local[0] != remote[0])
- {
- return remote;
- }
- }
// split up both paths into arrays of strings using / as a separator
std::string localString = local;
std::vector<cmStdString> localSplit = cmSystemTools::SplitString(local, '/', true);
@@ -1257,7 +1248,12 @@ std::string cmSystemTools::RelativePath(const char* local, const char* remote)
remoteSplit[sameCount] = "";
sameCount++;
}
-
+ // If there is nothing in common with the paths, then just return the remote
+ if(sameCount == 0)
+ {
+ return remote;
+ }
+
// for each entry that is not common in the local path
// add a ../ to the finalpath array, this gets us out of the local
// path into the remote dir