Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upLocalized file names and actual display names #845
Comments
steveklabnik
referenced this issue
Feb 14, 2015
Closed
Localized file names and actual display names #21569
steveklabnik
added
A-enhancement
labels
Feb 14, 2015
This comment has been minimized.
This comment has been minimized.
bluss
commented
Feb 14, 2015
|
path.display() is also only seriously for display. |
petrochenkov
added
T-libs
and removed
A-libs
labels
Jan 28, 2018
petrochenkov
removed
the
A-enhancement
label
Feb 24, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
steveklabnik commentedFeb 14, 2015
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()andDisplayguidelines 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.