cmSystemTools: Add ToNormalizedPathOnDisk helper

`CollapseFullPath` currently accesses the filesystem on Windows to
convert the path to the (upper/lower) case it has on disk.  Not all call
sites need this, so we'd eventually like to remove the behavior.  Add a
wrapper for call sites to express that they need to match the case of
on-disk paths.

Issue: #20214
This commit is contained in:
Brad King 2024-10-09 16:59:18 -04:00
parent b81c273445
commit 2503b43b6c
2 changed files with 9 additions and 0 deletions

View File

@ -1628,6 +1628,13 @@ std::vector<std::string> cmSystemTools::SplitEnvPath(std::string const& value)
return paths;
}
std::string cmSystemTools::ToNormalizedPathOnDisk(std::string p)
{
p = cmSystemTools::CollapseFullPath(p);
cmSystemTools::ConvertToUnixSlashes(p);
return p;
}
#ifndef CMAKE_BOOTSTRAP
bool cmSystemTools::UnsetEnv(const char* value)
{

View File

@ -401,6 +401,8 @@ public:
static cm::optional<std::string> GetEnvVar(std::string const& var);
static std::vector<std::string> SplitEnvPath(std::string const& value);
static std::string ToNormalizedPathOnDisk(std::string p);
#ifndef CMAKE_BOOTSTRAP
/** Remove an environment variable */
static bool UnsetEnv(const char* value);