在OS X中获取特殊的文件夹本地化名称 [英] Get special folder localized name in OS X

查看:104
本文介绍了在OS X中获取特殊的文件夹本地化名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个脚本,将一些文件复制到

I am writing a script that copies some files to

~/Library/Application Support/... 

目录.在非英语mac上,此脚本将失败,因为可能会使用不同的名称来调用库/应用程序支持".

directory. This script will fail on a non english mac because Library/Application Support may be called in a different name.

如何在bash中获取本地化的特殊文件夹名称?

How can I get a localized special folder name in bash?

优胜美地10.10.2

Yosemite 10.10.2

推荐答案

OS X不会本地化磁盘上文件或文件夹的名称.只会将它们本地化在GUI中.

OS X does not localize the names of files or folders on disk. It only localizes them in the GUI.

/Applications在磁盘上或在BSD/POSIX API层上访问时始终为/Applications.用德语,该文件夹将显示为"Programme",但磁盘上的实际目录名称仍为"Applications".

/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".

~/Library/Application Support和其余部分相同.

尽管在理论上您应该始终使用适当的API查找此类路径,但是taminov在注释中提供的链接仍然很好.但这与本地化无关.

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.

这篇关于在OS X中获取特殊的文件夹本地化名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆