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

filesystem::canonical fails to resolve relative path to a mapped folder #124

Closed
HamedSabri-adsk opened this issue May 19, 2021 · 4 comments
Assignees
Labels
available on master Fix is done on master branch, issue closed on next release bug Something isn't working Windows Windows platform is affected
Milestone

Comments

@HamedSabri-adsk
Copy link

Describe the bug

It appears to be a bug in gulark's filesystem::canonical which fails to properly resolve relative path to a mapped drive. C++17 std::filesystem::canonical doesn't have this issue and properly resolves the relative path.

In this scenario C:\MOUNT_ME is a folder that is mapped to a folder on an external hard drive G:\RTS on Windows:

    Plugin and external drive or USB Drive to your computer.
    Go to Disk Manager.
    Right Click on your connected drive.
    Select "Change Drive Letter and Path..."
    Select "Add".
    Use "Mount in the following empty NTFS folder:"
    Locate the folder you want to mount to.

ghc::filesystem::canonical

auto fullPath = ghc::filesystem::path(currentFileDir).append(relativeFilePath); 
// C:\\MOUNT_ME\\RTS\\RTS\\master_files\\..\\referenced_files\\USD\\barrelTests\\Library\\Assets\\Barrels\\Barrels.usd
auto path = ghc::filesystem::canonical(fullPath, errorCode); // error 

std::filesystem::canonical

auto fullPath = std::filesystem::path(currentFileDir).append(relativeFilePath);
//"C:\\MOUNT_ME\\RTS\\RTS\\master_files\\../referenced_files/USD/barrelTests/Library/Assets/Barrels/Barrels.usd"
auto path = std::filesystem::canonical(fullPath, errorCode); // Ok, good 

Expected behavior
ghc::filesystem::canonical should behave similar to std::filesystem::canonical.

Additional context
Autodesk/maya-usd#1422

@gulrak
Copy link
Owner

gulrak commented May 20, 2021

Thanks for reporting this! I'll try to get a fix into v1.5.6 scheduled for Sunday.

@gulrak gulrak self-assigned this May 20, 2021
@gulrak gulrak added bug Something isn't working Windows Windows platform is affected labels May 20, 2021
@gulrak gulrak added this to the v1.5.6 milestone May 20, 2021
@HamedSabri-adsk
Copy link
Author

Awesome! Thank you for quick response.

gulrak added a commit that referenced this issue May 23, 2021
gulrak added a commit that referenced this issue May 23, 2021
@gulrak gulrak added the available on master Fix is done on master branch, issue closed on next release label May 23, 2021
@gulrak
Copy link
Owner

gulrak commented May 24, 2021

Sorry for the delay, working on fixing up the new release now, should be out in a an hour or two.

@gulrak
Copy link
Owner

gulrak commented May 24, 2021

This is now part of release v1.5.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
available on master Fix is done on master branch, issue closed on next release bug Something isn't working Windows Windows platform is affected
Projects
None yet
Development

No branches or pull requests

2 participants