Closed
Description
I tried this code:
use std::path::PathBuf;
let cwindows: PathBuf = "C:\\Windows\\".into();
let cwindows_can = cwindows.canonicalize().unwrap();
// works correctly:
cwindows.join(r".\notepad.exe").canonicalize().unwrap();
// unexpectedly, following throws error "Not Found" error:
cwindows_can.join(r".\notepad.exe").canonicalize().unwrap();
I expected to see this happen:
Last line should work. Error on the last line means that already canonicalized path (with UNC start) cannot be re-canonicalized with relative paths in them.
This is especially problematic because canonicalize
is only way to normalize paths. Issue could be solved if there were a way to normalize paths (e.g. #59117) without calling Windows API, which probably is the culprit here.
Instead, this happened:
Last line throws an error.
Meta
rustc --version --verbose
:
rustc --version --verbose
rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-pc-windows-msvc
release: 1.49.0