• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Saving, file types, and non-document-based apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Saving, file types, and non-document-based apps
      • From: Yann Bizeul <email@hidden>
References: 
 >Saving, file types, and non-document-based apps (From: Mark Meyer <email@hidden>)
 >Re: Saving, file types, and non-document-based apps (From: Yann Bizeul <email@hidden>)

  • Prev by Date: Chess: signifies altered API?
  • Next by Date: Re: Saving, file types, and non-document-based apps
  • Previous by thread: Re: Saving, file types, and non-document-based apps
  • Next by thread: Re: Saving, file types, and non-document-based apps
  • Index(es):
    • Date
    • Thread