On Windows, this converts the path to use extended length path syntax, which allows your program to use longer path names, but means you can only join backslash-delimited paths to it, and it may be incompatible with other applications (if passed to the application on the command-line, or written to a file another application may read).
[UNC paths] are more robust and with fewer gotchas [compared to regular/legacy paths], but are rarely supported by Windows programs. Even Microsoft’s own!
This is causing issues - for example, setting IntelliJ IDEA as a diff editor does not work, but setting it as a merge editor does work - probably due to the inconsistent canonicalize-ation of the paths.
I think the most straightforward solution would be to use the aforementioned crate dunce, which could strip the prefix (if possible) before calling external tools.
This is acknowledged in the documentation for
std::fs::canonicalize
:and in the documentation for
dunce
, a Rust crate:This is causing issues - for example, setting IntelliJ IDEA as a diff editor does not work, but setting it as a merge editor does work - probably due to the inconsistent
canonicalize
-ation of the paths.I think the most straightforward solution would be to use the aforementioned crate
dunce
, which could strip the prefix (if possible) before calling external tools.