KWSys 2024-11-01 (1cfc8445)

Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 1cfc8445570dc46883e84301eb6c31ebc5867826 (master).

Upstream Shortlog
-----------------

Brad King (1):
      fdf4f2f8 SystemTools: Fix ReadSymlink for links to absolute paths on Windows
This commit is contained in:
KWSys Upstream
2024-11-01 07:49:35 -04:00
committed by Brad King
parent 875cf5f61f
commit f09390fbf1

View File

@@ -3392,6 +3392,14 @@ Status SystemTools::ReadSymlink(std::string const& newName,
} }
std::wstring substituteName(substituteNameData, substituteNameLength); std::wstring substituteName(substituteNameData, substituteNameLength);
origName = Encoding::ToNarrow(substituteName); origName = Encoding::ToNarrow(substituteName);
// Symbolic links to absolute paths may use a NT Object Path prefix.
// If the path begins with "\??\UNC\", replace it with "\\".
// Otherwise, if the path begins with "\??\", remove the prefix.
if (origName.compare(0, 8, "\\??\\UNC\\") == 0) {
origName.erase(1, 6);
} else if (origName.compare(0, 4, "\\??\\") == 0) {
origName.erase(0, 4);
}
#else #else
char buf[KWSYS_SYSTEMTOOLS_MAXPATH + 1]; char buf[KWSYS_SYSTEMTOOLS_MAXPATH + 1];
int count = static_cast<int>( int count = static_cast<int>(