2

コミック ファイル用のスポットライト インポーターを作成しました。属性が正常にインポートされ、検索可能になります。残っているのは、ファイルの情報取得ウィンドウに表示する属性を取得することです。

これは、属性が displayattrs タグ内にネストされるように、schema.xml ファイルを編集するだけの簡単な作業であると思われます。残念ながら、これは機能していないようです。

テスト用にプラグインを単純化しました。以下はすべて重要なファイルです。

schema.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

プラグインのフォルダ構造はどのようになっていますか?

schema.xmlを見つけて Spotlight インポーター プロセスで処理するには、次のようにする必要があります ( QuartzComposerから取得) 。

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