diff options
author | KWSys Upstream <kwrobot@kitware.com> | 2018-03-29 15:41:23 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-29 15:41:57 (GMT) |
commit | b66f18c84f89360768bf81c15ce0023840600e26 (patch) | |
tree | 2fb13a21e0cb7ac1ae6c55803dcb240097f6b965 | |
parent | 64d4308d8347150d072c2f11f9dd557ccaa1dfb2 (diff) | |
download | CMake-b66f18c84f89360768bf81c15ce0023840600e26.zip CMake-b66f18c84f89360768bf81c15ce0023840600e26.tar.gz CMake-b66f18c84f89360768bf81c15ce0023840600e26.tar.bz2 |
KWSys 2018-03-29 (488f2031)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit 488f203157792badb6204be513602d4e83884d21 (master).
Upstream Shortlog
-----------------
Ben Boeckel (1):
a3caaeec SystemTools: faster relative path codepath
Brad King (1):
805d9a7c Terminal: Add xterm-kitty to VT100 color support whitelist
luz.paz (1):
94484960 Source typo fix s/[Pp]athes/[Pp]aths/
-rw-r--r-- | SystemTools.cxx | 15 | ||||
-rw-r--r-- | Terminal.c | 1 | ||||
-rw-r--r-- | testSystemTools.cxx | 28 |
3 files changed, 25 insertions, 19 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx index 106afe5..52f509a 100644 --- a/SystemTools.cxx +++ b/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++]; @@ -153,6 +153,7 @@ static const char* kwsysTerminalVT100Names[] = { "Eterm", "xterm-88color", "xterm-color", "xterm-debian", + "xterm-kitty", "xterm-termite", 0 }; diff --git a/testSystemTools.cxx b/testSystemTools.cxx index e436a2b..a6d934b 100644 --- a/testSystemTools.cxx +++ b/testSystemTools.cxx @@ -738,29 +738,29 @@ static bool CheckGetPath() #endif const char* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]"; - std::vector<std::string> originalPathes; - originalPathes.push_back(registryPath); + std::vector<std::string> originalPaths; + originalPaths.push_back(registryPath); - std::vector<std::string> expectedPathes; - expectedPathes.push_back(registryPath); + std::vector<std::string> expectedPaths; + expectedPaths.push_back(registryPath); #ifdef _WIN32 - expectedPathes.push_back("C:/Somewhere/something"); - expectedPathes.push_back("D:/Temp"); + expectedPaths.push_back("C:/Somewhere/something"); + expectedPaths.push_back("D:/Temp"); #else - expectedPathes.push_back("/Somewhere/something"); - expectedPathes.push_back("/tmp"); + expectedPaths.push_back("/Somewhere/something"); + expectedPaths.push_back("/tmp"); #endif bool res = true; res &= CheckPutEnv(std::string(envName) + "=" + envValue, envName, envValue); - std::vector<std::string> pathes = originalPathes; - kwsys::SystemTools::GetPath(pathes, envName); + std::vector<std::string> paths = originalPaths; + kwsys::SystemTools::GetPath(paths, envName); - if (pathes != expectedPathes) { - std::cerr << "GetPath(" << StringVectorToString(originalPathes) << ", " - << envName << ") yielded " << StringVectorToString(pathes) - << " instead of " << StringVectorToString(expectedPathes) + if (paths != expectedPaths) { + std::cerr << "GetPath(" << StringVectorToString(originalPaths) << ", " + << envName << ") yielded " << StringVectorToString(paths) + << " instead of " << StringVectorToString(expectedPaths) << std::endl; res = false; } |