2

我为漫画文件创建了一个聚光灯导入器。属性已成功导入并可搜索。剩下的一件事是让属性显示在文件的获取信息窗口中。

似乎这应该是编辑 schema.xml 文件的简单问题,因此属性嵌套在 displayattrs 标记中。不幸的是,这似乎不起作用。

我简化了测试插件。以下是所有重要文件。

架构.xml

<types>
<type name="cx.c3.cbz-archive">  
    <allattrs>
        kMDItemTitle
        kMDItemAuthors
    </allattrs>
    <displayattrs>
        kMDItemTitle
        kMDItemAuthors
    </displayattrs>
    </type>
<type name="cx.c3.cbr-archive">  
    <allattrs>
        kMDItemTitle
        kMDItemAuthors
        </allattrs>
    <displayattrs>
        kMDItemTitle
        kMDItemAuthors
    </displayattrs>
</type>
</types>

GetMetadataForFile.m

Boolean GetMetadataForFile(void* thisInterface, 
                       CFMutableDictionaryRef attributes, 
                       CFStringRef contentTypeUTI,
                       CFStringRef pathToFile)
{
    NSAutoreleasePool * pool = [NSAutoreleasePool new];
    NSString * file = (NSString *)pathToFile;
    NSArray * authors = [[UKXattrMetadataStore stringForKey: @"com_opencomics_authors" atPath: file traverseLink: NO] componentsSeparatedByString: @","];
    [(NSMutableDictionary *)attributes setObject: authors forKey: (id)kMDItemAuthors];
    NSString * title = [UKXattrMetadataStore stringForKey: @"com_opencomics_title" atPath: file traverseLink: NO];
    [(NSMutableDictionary *)attributes setObject: title forKey: (id)kMDItemTitle];
    [pool release];
    return true;
}
4

2 回答 2

1

您似乎缺少一个</types>标签。编写问题时复制/粘贴错误,或者 XML 文件中也缺少它?

如果文件中缺少它,则 XML 无效。

于 2010-05-15T20:25:48.853 回答
0

你的插件文件夹结构是什么样的?

它应该是这样的(取自QuartzComposer),以便Spotlight 导入器进程找到并处理schema.xml :

Contents
   Info.plist
   MacOS
      QuartzComposer
   Resources
      schema.xml
   version.plist
于 2012-10-01T06:10:19.043 回答