osx 的 Containers 软链接很感人

2015-10-15 22:24:03 +08:00
 kittyoung
ll ~/Library/Containers/com.apple.AddressBook/Data/Library/Application\ Support
total 24
drwx------ 5 host staff 170 10 11 19:24 ./
drwx------ 29 host staff 986 10 11 19:24 ../
lrwxr-xr-x 1 host staff 46 10 11 19:24 AddressBook@ -> ../../../../../Application Support/AddressBook
lrwxr-xr-x 1 host staff 47 10 11 19:24 SyncServices@ -> ../../../../../Application Support/SyncServices
lrwxr-xr-x 1 host staff 41 10 11 19:24 iCloud@ -> ../../../../../Application Support/iCloud

why not ~/Library/Application Support/ ???
1522 次点击
所在节点    macOS
3 条回复
MartinWu
2015-10-16 15:15:55 +08:00
相对路径一个好处就是整个 Containers 变动了位置,也不会影响软链。
kittyoung
2015-10-16 18:45:45 +08:00
@MartinWu 可以举例说明吗
MartinWu
2015-10-20 14:24:42 +08:00
@kittyoung 例如我在一个目录 S 下面有两个 shell 脚本, A.sh 然后 ln -s ./A.sh B.sh 。 现在 S 是放在 /home/xx 下,我可以直接 bash /home/xx/S/B.sh 。然后现在 S 换个目录 ,放到 /tmp 下。那我还是 bash /tmp/S/B.sh 没问题。 但是如果你一开始 是 ln -s /home/xx/S/A.sh B.sh ,后面换到 /tmp 目录,你就只能重建软链接了。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/228384

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX