mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 04:09:33 -05:00
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/
This commit is contained in:
committed by
Brad King
parent
64d4308d83
commit
b66f18c84f
+10
-5
@@ -3344,15 +3344,20 @@ std::string SystemTools::RelativePath(const std::string& local,
|
|||||||
static std::string GetCasePathName(std::string const& pathIn)
|
static std::string GetCasePathName(std::string const& pathIn)
|
||||||
{
|
{
|
||||||
std::string casePath;
|
std::string casePath;
|
||||||
std::vector<std::string> path_components;
|
|
||||||
SystemTools::SplitPath(pathIn, path_components);
|
// First check if the file is relative. We don't fix relative paths since the
|
||||||
if (path_components[0].empty()) // First component always exists.
|
// real case depends on the root directory and the given path fragment may
|
||||||
{
|
// have meaning elsewhere in the project.
|
||||||
// Relative paths cannot be converted.
|
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;
|
casePath = pathIn;
|
||||||
return casePath;
|
return casePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> path_components;
|
||||||
|
SystemTools::SplitPath(pathIn, path_components);
|
||||||
|
|
||||||
// Start with root component.
|
// Start with root component.
|
||||||
std::vector<std::string>::size_type idx = 0;
|
std::vector<std::string>::size_type idx = 0;
|
||||||
casePath = path_components[idx++];
|
casePath = path_components[idx++];
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ static const char* kwsysTerminalVT100Names[] = { "Eterm",
|
|||||||
"xterm-88color",
|
"xterm-88color",
|
||||||
"xterm-color",
|
"xterm-color",
|
||||||
"xterm-debian",
|
"xterm-debian",
|
||||||
|
"xterm-kitty",
|
||||||
"xterm-termite",
|
"xterm-termite",
|
||||||
0 };
|
0 };
|
||||||
|
|
||||||
|
|||||||
+14
-14
@@ -738,29 +738,29 @@ static bool CheckGetPath()
|
|||||||
#endif
|
#endif
|
||||||
const char* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]";
|
const char* registryPath = "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MyApp; MyKey]";
|
||||||
|
|
||||||
std::vector<std::string> originalPathes;
|
std::vector<std::string> originalPaths;
|
||||||
originalPathes.push_back(registryPath);
|
originalPaths.push_back(registryPath);
|
||||||
|
|
||||||
std::vector<std::string> expectedPathes;
|
std::vector<std::string> expectedPaths;
|
||||||
expectedPathes.push_back(registryPath);
|
expectedPaths.push_back(registryPath);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
expectedPathes.push_back("C:/Somewhere/something");
|
expectedPaths.push_back("C:/Somewhere/something");
|
||||||
expectedPathes.push_back("D:/Temp");
|
expectedPaths.push_back("D:/Temp");
|
||||||
#else
|
#else
|
||||||
expectedPathes.push_back("/Somewhere/something");
|
expectedPaths.push_back("/Somewhere/something");
|
||||||
expectedPathes.push_back("/tmp");
|
expectedPaths.push_back("/tmp");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool res = true;
|
bool res = true;
|
||||||
res &= CheckPutEnv(std::string(envName) + "=" + envValue, envName, envValue);
|
res &= CheckPutEnv(std::string(envName) + "=" + envValue, envName, envValue);
|
||||||
|
|
||||||
std::vector<std::string> pathes = originalPathes;
|
std::vector<std::string> paths = originalPaths;
|
||||||
kwsys::SystemTools::GetPath(pathes, envName);
|
kwsys::SystemTools::GetPath(paths, envName);
|
||||||
|
|
||||||
if (pathes != expectedPathes) {
|
if (paths != expectedPaths) {
|
||||||
std::cerr << "GetPath(" << StringVectorToString(originalPathes) << ", "
|
std::cerr << "GetPath(" << StringVectorToString(originalPaths) << ", "
|
||||||
<< envName << ") yielded " << StringVectorToString(pathes)
|
<< envName << ") yielded " << StringVectorToString(paths)
|
||||||
<< " instead of " << StringVectorToString(expectedPathes)
|
<< " instead of " << StringVectorToString(expectedPaths)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
res = false;
|
res = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user