Setting a document's icon and default app
Setting a document's icon and default app
- Subject: Setting a document's icon and default app
- From: Michael Domino <email@hidden>
- Date: Thu, 02 Jul 2009 10:06:49 -0400
- Thread-topic: Setting a document's icon and default app
Hi,
I¹ve set up my app with a document type (see below), moved the app to
Applications, logged out, logged back in, created a document of this type,
but the setting the doc¹s icon and association with my app does not occur
automatically, only when I manually do Get Info and set it. What am I
missing here? Is there a function I should be calling to make this happen
when the file is created?
I do changeFileAttributes to set the classic HFS file type and creator code,
but it does not seem to have any effect (I guess I did not expect it to, but
you never know)
NSDictionary* attributes = [NSDictionary
dictionaryWithObjectsAndKeys:
@"IDFV", NSFileHFSTypeCode,
@"IDFD", NSFileHFSCreatorCode,
nil];
NSString* path = // set the path here
BOOL changedOK = [[NSFileManager defaultManager]
changeFileAttributes:attributes atPath:path];
Thanks for your advice,
Michael
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>idfvault</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>idfvault.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/idfvault</string>
</array>
<key>CFBundleTypeName</key>
<string>Identity Finder File Vault</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
<string>IDFV</string>
</array>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSItemContentTypes</key>
<array>
<string>com.identityfinder.identityfinderenterpriseedition.idfvault</string>
</array>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
</array>
</plist>
--
Michael Domino
email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden