Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path resolution for mounted volumes in Windows does not work correctly #1746

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pxr/base/arch/fileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,14 @@ std::string ArchReadLink(const char* path)
std::wstring ws(reparsePath.get());
string str(ws.begin(), ws.end());

// Mount point paths starting with \?? are NT Object Manager paths
// and cannot be used as file paths, so disable converting the path
// by returning the original path.
//
// See: https://superuser.com/questions/1069055/what-is-the-function-of-question-marks-in-file-system-paths-in-windows-registry
if (str.length() >= 3 && str.substr(0, 3) == "\\??")
return path;

// Note that junctions do not support the relative path form
// like SYMLINKS do, so nothing more to do here.

Expand Down
12 changes: 7 additions & 5 deletions pxr/base/tf/pathUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ _ExpandSymlinks(const std::string& path)
prefix.push_back('\\');
}
if (TfIsLink(prefix)) {
// Expand the link and repeat with the new path.
return _ExpandSymlinks(TfReadLink(prefix) + path.substr(i));
}
else {
i = path.find_first_of("/\\", i + 1);
// Expand the link and repeat with the new path if the path changed.
// The path may remain unchanged or be empty if the link type is
// unsupported or the mount destination is not available.
auto newPrefix = TfReadLink(prefix);
if (!newPrefix.empty() && newPrefix != prefix)
return _ExpandSymlinks(newPrefix + path.substr(i));
}
i = path.find_first_of("/\\", i + 1);
}

// No ancestral symlinks.
Expand Down