【问题标题】:How to access finder sidebar shared content in cocoa如何访问可可中的查找器侧边栏共享​​内容
【发布时间】:2013-07-31 06:29:54
【问题描述】:

我想在mac中访问finder左侧边栏的共享内容,这样我就可以得到连接到同一网络的系统列表。我可以访问喜欢的内容,但无法成功访问。

我正在使用此代码访问 finder 的收藏内容。

UInt32 seed;
LSSharedFileListRef sflRef = LSSharedFileListCreate(NULL,
                                                    kLSSharedFileListFavoriteItems,
                                                    NULL);
CFArrayRef items = LSSharedFileListCopySnapshot( sflRef, &seed );
for( size_t i = 0; i < CFArrayGetCount(items); i++ )
{
    LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(items, i);
    if( !item )
        continue;
    CFURLRef outURL = NULL;
    LSSharedFileListItemResolve( item, kLSSharedFileListNoUserInteraction, (CFURLRef*) &outURL, NULL );
    if( !outURL )
        continue;
    //The actual path string of the item
    CFStringRef itemPath = CFURLCopyFileSystemPath(outURL,kCFURLPOSIXPathStyle);
    // TODO: Do whatever you want to do with your path here!!!!
    CFRelease(outURL);
    CFRelease(itemPath);
}
CFRelease(items);
CFRelease(sflRef);


Since i want to access systems available in shared network i change the key according to the key in the header file 

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.fram‌​ework/Headers/LSSharedFileList.h

But i get nothing for shared content.

Can anyone help me for accessing this.
Thanks for your time to help me in advance.

【问题讨论】:

  • 任何编码尝试?
  • 是的,我使用来自stackoverflow.com/questions/10751199/… 的信息获取收藏夹内容,但 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSSharedFileList.h 头文件中的任何可用键不提供有关共享内容的信息
  • 请在问题中显示您的代码

标签: macos cocoa shared-libraries finder


【解决方案1】:

您可以使用kLSSharedFileListRecentServerItems 获取最近连接的网络卷。

【讨论】:

    猜你喜欢
    • 2017-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多