summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-03-29 15:41:57 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-29 15:41:57 (GMT)
commit4c90e94368b5bda54e8e52bcad228f0d05804316 (patch)
tree97db989a5533c068d38e7c597652bf1e8b59e0a0 /Source/kwsys/SystemTools.cxx
parent894a41fc275b454e3d9da04b6e15244099269c74 (diff)
parentb66f18c84f89360768bf81c15ce0023840600e26 (diff)
downloadCMake-4c90e94368b5bda54e8e52bcad228f0d05804316.zip
CMake-4c90e94368b5bda54e8e52bcad228f0d05804316.tar.gz
CMake-4c90e94368b5bda54e8e52bcad228f0d05804316.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys: KWSys 2018-03-29 (488f2031)
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 106afe5..52f509a 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -3344,15 +3344,20 @@ std::string SystemTools::RelativePath(const std::string& local,
static std::string GetCasePathName(std::string const& pathIn)
{
std::string casePath;
- std::vector<std::string> path_components;
- SystemTools::SplitPath(pathIn, path_components);
- if (path_components[0].empty()) // First component always exists.
- {
- // Relative paths cannot be converted.
+
+ // First check if the file is relative. We don't fix relative paths since the
+ // real case depends on the root directory and the given path fragment may
+ // have meaning elsewhere in the project.
+ if (!SystemTools::FileIsFullPath(pathIn)) {
+ // This looks unnecessary, but it allows for the return value optimization
+ // since all return paths return the same local variable.
casePath = pathIn;
return casePath;
}
+ std::vector<std::string> path_components;
+ SystemTools::SplitPath(pathIn, path_components);
+
// Start with root component.
std::vector<std::string>::size_type idx = 0;
casePath = path_components[idx++];