You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rust's path.display() and Display guidelines sound like they're exactly for this purpose, but unfortunately path.display() falls short on OS X and probably can't be fixed without breaking at least some Cargo build scripts.
However, in OS X "display path" is seriously only for display and it's a one-way function:
[fm displayNameAtPath:@"/Applications"] == @"アプリケーション"; // If Japanese locale is set
[fm displayNameAtPath:@"foo:bar"] == @"foo/bar"; // Yes, Finder allows slashes in file names
I'd be lovely if Rust had built-in support for this and encouraged doing the right thing on OS X and other OSes that have localized paths.
Suggestions:
Add path.filename_localized() and path.components_localized()
Drop path.filename_display()
Rename path.display() to path.to_string_lossy(), to make it clear that a code like println!("cargo:root={}", path.display()); is slightly buggy.
Add format_bytes!() to make it easier to correctly format commandline arguments with paths.
The text was updated successfully, but these errors were encountered:
Issue by pornel
Friday Jan 23, 2015 at 22:38 GMT
For earlier discussion, see rust-lang/rust#21569
This issue was labelled with: A-io, A-libs, A-mac-osx in the Rust repository
In OS X you're not supposed to display POSIX paths to users. User-facing file names are supposed to use "display name" (
[NSFilemanager displayNameAtPath:]
and friends).Rust's
path.display()
andDisplay
guidelines sound like they're exactly for this purpose, but unfortunatelypath.display()
falls short on OS X and probably can't be fixed without breaking at least some Cargo build scripts.However, in OS X "display path" is seriously only for display and it's a one-way function:
I'd be lovely if Rust had built-in support for this and encouraged doing the right thing on OS X and other OSes that have localized paths.
Suggestions:
path.filename_localized()
andpath.components_localized()
path.filename_display()
path.display()
topath.to_string_lossy()
, to make it clear that a code likeprintln!("cargo:root={}", path.display());
is slightly buggy.format_bytes!()
to make it easier to correctly format commandline arguments with paths.The text was updated successfully, but these errors were encountered: