Localized file names and actual display names
Nobody has claimed this yet.
- Dominant language
- Markdown
- Stars
- 6.6k
- Forks
- 1.7k
- Avg merge
- 16h 14m
- Merged PRs (30d)
- 1
Description
Issue by pornel
Friday Jan 23, 2015 at 22:38 GMT
For earlier discussion, see https://github.com/rust-lang/rust/issues/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() 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()andpath.components_localized() - Drop
path.filename_display() - Rename
path.display()topath.to_string_lossy(), to make it clear that a code likeprintln!("cargo:root={}", path.display());is slightly buggy. - Add
format_bytes!()to make it easier to correctly format commandline arguments with paths.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the earlier discussion in rust-lang/rust#21569 and the linked NSFileManager displayNameAtPath documentation, then compare them with Rust's path.display() and Display guidelines. Done means the scope for localized and display path APIs is decided, including the proposed formatting behavior and platform implications.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, rust
- Domain
- operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100