On 2/26/08 12:45 AM, Quincey Morris said: >On Feb 26, 2008, at 00:16, Gerriet M. Denkmann wrote: > >> I have an application (10.4.11) which creates simple text files >> (utf-8 or utf-16). >> When I store some document as "myNewFile" then Spotlight does know >> nothing about it's content. >> But when I store the same file as "myNewFile.txt" then all is fine. >> >> Is there a way to tell Spotlight to treat all files with >> NSFileHFSCreatorCode = 'MyAp' as if it had a ".txt" file extention? >> Or: if NSFileHFSCreatorCode = 'MyAp' then treat it as public.plain- >> text (unless the file extention says otherwise). > >Your file is going to need a application-defined UTI, which is defined >in the app's info.plist file. That private UTI definition can also >equate your private HFS creator code to the private UTI, but there's >not much point in using that mechanism if you're saving the file with >a UTI anyway. I'm guessing that spotlight will happily index a file >with UTI public.plain-text.something-your-application-defined as a >text file, but I don't know for sure.
UTIs have no connection to creator codes. A UTI is defined in terms of: a) filename extension b) HFS type code c) MIME type A UTI _cannot_ be attached to a file as metadata, and a UTI cannot be determined by the system by examining the file's contents. If a file has no filename extension and no HFS type, then no creator code will help you, custom importer or not. Gerriet, could you give your files an HFS type of 'TEXT'? If not, give them a unique HFS type and make your own UTI declaration. -- ____________________________________________________________ Sean McBride, B. Eng [EMAIL PROTECTED] Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]