fix: replace std::fs::canonicalize with Simplified::simple_canonicaliz…#6776
Conversation
…e for CANONICAL_CWD to improve reliability on Windows, particularly when resolving paths on mapped network drives.
|
Interesting. But doesn't |
… canonicalized on Windows (e.g. on a network drive or RAM drive), fallback to `std::path::absolute()` if the path exists
|
Absolutely true. Paths that can't be canonicalized by In the latest commit, I updated the I've tested it locally on a mapped network drive on Windows, where the latest version of |
|
Ok, I think something like this is reasonable, but I may follow-up to reduce the scope a bit. |
Summary
This PR addresses an issue on Windows where
std::fs::canonicalizecan fail or panic when resolving paths on mapped network drives. By replacing it withSimplified::simple_canonicalize, we aim to improve the robustness and cross-platform compatibility of path resolution.Changes
CANONICAL_CWDinpath.rsto useSimplified::simple_canonicalizeinstead ofstd::fs::canonicalize.Why
std::fs::canonicalizehas known issues with resolving paths on mapped network drives on Windows, which can lead to panics or incorrect path resolution.Simplified::simple_canonicalizeinternally usesdunce::canonicalize, which handles these cases more gracefully, ensuring better stability and reliability.Test Plan
Since
simple_canonicalizehas already been tested in a prior PR, this change is expected to work without introducing any new issues. No additional tests are necessary beyond ensuring existing tests pass, which will confirm the correctness of the change.