将项目添加到Finder侧栏 [英] Add Item to Finder Sidebar

查看:381
本文介绍了将项目添加到Finder侧栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Finder侧栏中添加一个新项目。我发现Finder保存地方的列表在`〜/ Library / Preferences / com.apple.sidebarlists.plist。我能够使用Carbon API读取文件,并看到每个项目都有名称,图标和别名。

I would like to add a new item to the Finder sidebar. I found out that the Finder keeps the list of "places" in `~/Library/Preferences/com.apple.sidebarlists.plist. I was able to read the file using Carbon API and saw that each item had Name, icon and alias.

使用第三方应用程式(例如PlistEdit Pro)可以更新别名。我的问题是如何使用Carbon API更新别名。无法找到一种方法来创建将在Finder中打开的别名。看来,Dropbox和PlistEditor Pro都能找到方法。

Using a 3rd party application such as PlistEdit Pro I was able to update the alias. My question is how to update the alias using Carbon API. Was not able to find a way to create alias that will open in Finder. It seem that both Dropbox and PlistEditor Pro was able to find the way.

编辑查看更新的2015年答案

See updated 2015 answer

推荐答案

查看此处


共享文件列表API是新的
在Mac OS X Leopard中启动服务。
此API提供访问文件系统
对象的几个
种系统全局和每个用户
持久性列表,例如最近的文档和
应用程序,收藏,并登录
项。有关详细信息,请参阅新的
接口文件LSSharedFileList.h。

The Shared File List API is new to Launch Services in Mac OS X Leopard. This API provides access to several kinds of system-global and per-user persistent lists of file system objects, such as recent documents and applications, favorites, and login items. For details, see the new interface file LSSharedFileList.h.

您要查找键kLSSharedFileListFavoriteItems,侧边栏中地方信息下的项目。
我想你可以尝试做类似

You want to look for the key kLSSharedFileListFavoriteItems, which handles the items under "Places" in the Sidebar. I guess you could try to do something similar to this, using LSSharedFileListCreate to create kLSSharedFileListFavoriteItems.

或者你可以使用在这里,这将更容易,但不是正确的方式©

Or you could use the applescript posted here, which would be way easier, but not the "Right Way"©

这篇关于将项目添加到Finder侧栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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