mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
cmSystemTools: Add SplitEnvPathNormalized to split paths from environment
This commit is contained in:
@@ -1961,11 +1961,13 @@ void cmFindPackageCommand::PushFindPackageRootPathStack()
|
||||
cmExpandList(*rootDEF, rootPaths);
|
||||
}
|
||||
if (rootEnv) {
|
||||
std::vector<std::string> p = cmSystemTools::SplitEnvPath(*rootEnv);
|
||||
std::vector<std::string> p =
|
||||
cmSystemTools::SplitEnvPathNormalized(*rootEnv);
|
||||
std::move(p.begin(), p.end(), std::back_inserter(rootPaths));
|
||||
}
|
||||
if (rootENV) {
|
||||
std::vector<std::string> p = cmSystemTools::SplitEnvPath(*rootENV);
|
||||
std::vector<std::string> p =
|
||||
cmSystemTools::SplitEnvPathNormalized(*rootENV);
|
||||
std::move(p.begin(), p.end(), std::back_inserter(rootPaths));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1635,9 +1635,15 @@ std::vector<std::string> cmSystemTools::SplitEnvPath(cm::string_view in)
|
||||
}
|
||||
paths.emplace_back(in.substr(b, e - b));
|
||||
}
|
||||
for (std::string& p : paths) {
|
||||
SystemTools::ConvertToUnixSlashes(p);
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
std::vector<std::string> cmSystemTools::SplitEnvPathNormalized(
|
||||
cm::string_view in)
|
||||
{
|
||||
std::vector<std::string> paths = cmSystemTools::SplitEnvPath(in);
|
||||
std::transform(paths.begin(), paths.end(), paths.begin(),
|
||||
cmSystemTools::ToNormalizedPathOnDisk);
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
||||
@@ -401,6 +401,7 @@ public:
|
||||
static cm::optional<std::string> GetEnvVar(std::string const& var);
|
||||
|
||||
static std::vector<std::string> SplitEnvPath(cm::string_view in);
|
||||
static std::vector<std::string> SplitEnvPathNormalized(cm::string_view in);
|
||||
|
||||
static std::string ToNormalizedPathOnDisk(std::string p);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user