在Finder中以编程方式将文件夹添加到“Places”
我试图弄清楚如何以编程方式将文件夹添加到Finder的Places Places边栏。我已经看到了通过Finder Preferences来修改它的方法,但我也看到一些应用程序实际上将文件夹添加到侧边栏。在Finder中以编程方式将文件夹添加到“Places”
如果有人有任何意见/指点我应该是什么了,这将是极大的赞赏
(这是雪豹豹...希望它并没有改变)
尝试这样的:
-(void) addPathToSharedItem:(NSString *)path
{
CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:path];
// Create a reference to the shared file list.
LSSharedFileListRef favoriteItems = LSSharedFileListCreate(NULL,
kLSSharedFileListFavoriteItems, NULL);
if (favoriteItems) {
//Insert an item to the list.
LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(favoriteItems,
kLSSharedFileListItemLast, NULL, NULL,
url, NULL, NULL);
if (item){
CFRelease(item);
}
}
CFRelease(favoriteItems);
}
是纯吓坏金! – 2012-10-10 07:40:10
如何在沙箱中做到这一点?以上失败,只有一个黑客直接写入该文件夹适用于我:D – 2012-11-08 09:47:53
我有尝试,但它的工作只有当沙盒模式禁用.. :(:(你有谁知道如何可以在沙箱模式添加收藏夹中的文件夹模式..? – 2015-04-04 05:51:49
好像这是问,最近回答:http://stackoverflow.com/questions/4852516/add-place-to-finder-sidebar – 2011-02-03 02:21:21