-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
current_exe return \\\?\\ prefix symbols #99931
Comments
libstd uses rust/library/std/src/sys/windows/os.rs Line 239 in e50ff9b
\\?\ prefixed paths. libstd can handle these paths just fine, and they are mandatory when the path gets too long. Not a windows expert, but I did say not a bug.
|
These are valid paths. If you need to pass them to an application which can't handle them you can try using the dunce crate, but it's not guaranteed that this will work for all paths because verbatim paths can refer to files that are unnamable by non-verbatim ones. Not only due to lengths but also due to some parsing that happens. |
There is also unstable |
Largely a… Duplicate of #59117 |
#59117 seems to be a separate issue about turning paths absolute. |
due to rust feature on windows rust-lang/rust#99931 use dunce::canonicalize() to get proper name
due to rust feature on windows rust-lang/rust#99931 use dunce::canonicalize() to get proper name
due to rust feature on windows rust-lang/rust#99931 use dunce::canonicalize() to get proper name
due to rust feature on windows rust-lang/rust#99931 use dunce::canonicalize() to get proper name
due to rust feature on windows rust-lang/rust#99931 use dunce::canonicalize() to get proper name
due to rust feature on windows rust-lang/rust#99931 use dunce::canonicalize() to get proper name
due to rust feature on windows rust-lang/rust#99931 use dunce::canonicalize() to get proper name
Background:
I use current_exe() on Windows, but std::env::current_exe() return "\\?\D:\code\test\target\debug\test.exe"
Steps to Reproduce:
fn main() {
let program_dir=std::env::current_exe().unwrap();
println!("program_dir {:?}",&program_dir);
}
Rust Version:
rustc 1.62.1 (e092d0b 2022-07-16)
Expected Behavior:
I would expect to get:
"D:\code\test\target\debug\test.exe"
Actual Behavior:
"\\?\D:\code\test\target\debug\test.exe"
The text was updated successfully, but these errors were encountered: