Get special folder localized name in OS X

限于喜欢 提交于 2019-12-25 03:14:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!