Re: Saving, file types, and non-document-based apps
Re: Saving, file types, and non-document-based apps
- Subject: Re: Saving, file types, and non-document-based apps
- From: "M. Uli Kusterer" <email@hidden>
- Date: Wed, 12 Jan 2005 15:39:33 +0100
Personaly, I would try to setup target info, and define the "OS
Type" column. This is the old style finder document identification
mechanism, and you can setup this attribute according to this sample
:
NSString *fullPath = @"/Path/to/your/doc";
NSDictionary *attributes = [[[NSFileManager
defaultManager]fileAttributesAtPath:fullPath
traverseLink:YES]mutableCopy];
[attributes setObject: [NSNumber numberWithUnsignedLong: 'MyFT']
forKey: NSFileHFSTypeCode];
[[NSFileManager defaultManager]changeFileAttributes:attributes
atPath:fullPath];
[attributes release];
Almost. He'll rather want to specify a Creator Code, not a file type.
The Creator Code specifies the application that owns a document. The
type code is basically functionally equivalent to the file name
suffix.
And in addition, the NSDictionary* attributes should be
NSMutableDictionary*, because that's what mutableCopy will give you.
That'll also shut up the "NSDictionary may not respond to
setObject:forKey:" warnings you'll deservedly get otherwise.
Also, as a matter of style, I'd suggest to always do
NSMutableSomething* s = [[something mutableCopy] autorelease];
instead of
NSMutableSomething* s = [something mutableCopy];
// Do more stuff...
[s release];
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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