问题
I am writing a script that copies some files to
~/Library/Application Support/...
directory. This script will fail on a non english mac because Library/Application Support may be called in a different name.
How can I get a localized special folder name in bash?
Yosemite 10.10.2
回答1:
OS X does not localize the names of files or folders on disk. It only localizes them in the GUI.
/Applications
is always /Applications
on disk or when accessed at the BSD/POSIX API layer. In German, that folder will be displayed as "Programme", but the actual directory name on disk is still "Applications".
Same for ~/Library/Application Support
and the rest.
The link provided by taminov in the comments is still good, though, since you should theoretically always look up such paths using the appropriate API. But it has nothing to do with localization.
来源:https://stackoverflow.com/questions/28546799/get-special-folder-localized-name-in-os-x