diff --git a/pxr/base/arch/fileSystem.cpp b/pxr/base/arch/fileSystem.cpp index c4a7aaddff..b06a926ffa 100644 --- a/pxr/base/arch/fileSystem.cpp +++ b/pxr/base/arch/fileSystem.cpp @@ -545,6 +545,15 @@ ArchGetFileName(FILE *file) CP_UTF8, 0, filePath, -1, &result.front(), outSize, NULL, NULL); + + if (result.length() > 4) + { + std::string prefix = result.substr(0, 4); + if (prefix == "\\\\?\\" || prefix == "\\\\.\\") + { + result = result.substr(4); + } + } } return result; #else diff --git a/pxr/base/arch/testenv/testFileSystem.cpp b/pxr/base/arch/testenv/testFileSystem.cpp index dd407e2a78..f005783eef 100644 --- a/pxr/base/arch/testenv/testFileSystem.cpp +++ b/pxr/base/arch/testenv/testFileSystem.cpp @@ -63,28 +63,6 @@ _AbsPathFilter(const std::string& path) return path; #endif } - -std::string -_DosDevicePathFilter(const std::string& path) -{ -#if defined(ARCH_OS_WINDOWS) - // Strip prefix \\?\ or \\.\ and convert backslashes to forward slashes. - std::string result = path; - if (result.length() > 4) - { - std::string prefix = result.substr(0, 4); - if (prefix == "\\\\?\\" || prefix == "\\\\.\\") - { - result = result.substr(4); - } - } - - return ArchNormPath(result); -#else - // Return path as-is. - return path; -#endif -} } static bool @@ -117,7 +95,7 @@ int main() // Open a file, check that the file path from FILE* handle is matched. ARCH_AXIOM((firstFile = ArchOpenFile(firstName.c_str(), "rb")) != NULL); std::string filePath = ArchGetFileName(firstFile); - ARCH_AXIOM(_DosDevicePathFilter(filePath) == _DosDevicePathFilter(firstName)); + ARCH_AXIOM(ArchNormPath(filePath) == ArchNormPath(firstName)); fclose(firstFile); // Map the file and assert the bytes are what we expect they are.