Setting UTI's in non-document based app
Setting UTI's in non-document based app
- Subject: Setting UTI's in non-document based app
- From: Adam Leonard <email@hidden>
- Date: Fri, 21 Apr 2006 00:08:41 -0700
Hi, sorry to ask another question, but I can't figure this out and it
is semi-urgent
I have a non-document based app that makes a bunch of files with my
custom extension. I write the files like this:
NSDictionary *result = [NSDictionary dictionaryWithObjects:[NSArray
arrayWithObjects:[titles objectAtIndex:i],[URLs objectAtIndex:i],
[descriptions objectAtIndex:i],[self searchTerms],nil]
forKeys:[NSArray
arrayWithObjects:@"titleArrayKey",@"urlArrayKey",@"descriptionsArrayKey"
,@"searchTermsKey",nil]];
NSData *resultAsData = [NSArchiver
archivedDataWithRootObject:result];
NSFileWrapper *wrapper = [[NSFileWrapper alloc]
initRegularFileWithContents:resultAsData];
NSMutableDictionary *fileAttributes = [[wrapper fileAttributes]
mutableCopy];
[fileAttributes setObject:[NSNumber numberWithUnsignedLong:'GOSP']
forKey:NSFileHFSCreatorCode];
[fileAttributes removeObjectForKey:NSFileModificationDate];
[fileAttributes removeObjectForKey:NSFileCreationDate];
[wrapper setFileAttributes:fileAttributes];
if(![wrapper writeToFile:[applicationSupportDirectory
stringByAppendingPathComponent:[NSString stringWithFormat:@"%
i.resulturl",i]]
atomically:YES
updateFilenames:YES])
{
...
}
[wrapper release];
[fileAttributes release];
I then have a spotlight importer that declares the UTI in its
info.plist file
It seems that after a while (many hours, usually), the system
recognizes the UTI. However, before that, mdls says that it has a
dynamic UTI like dyn.xxxx...
So, my question is how can I get this to happen immediately.
Any advice would be appreciated.
Adam Leonard
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden