• 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: Creator Code in Cocoa-Java App
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creator Code in Cocoa-Java App


  • Subject: Re: Creator Code in Cocoa-Java App
  • From: Ali Ozer <email@hidden>
  • Date: Wed, 31 Jul 2002 10:55:08 -0700

How can I set the creator code of a file in a Cocoa-Java app?

I tried using MRJFileUtils.setFileCreator(file, new MRJOSType("xxxx")) but
that freezes the app.

Is there another way to set the creator code of a file in a Cocoa-Java app?

In ObjC, NSFileManager does this; in Cocoa/Java, the functionality is exposed in NSPathUtilities, as NSPathUtilities.setFileAttributes(). Unfortunately in 10.1 the possible keys to this are not explicitly defined, but for creator use "NSFileHFSCreatorCode".

Something like:

NSMutableDictionary fileAttrs = new NSMutableDictionary();
fileAttrs.setObjectForKey(new Integer(0x41414141), "NSFileHFSCreatorCode"); // Set creator to "AAAA"
NSPathUtilities.setFileAttributes(fileName, fileAttrs);

Ali
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Creator Code in Cocoa-Java App (From: "Shoaib" <email@hidden>)

  • Prev by Date: Re: Treating several controls as an array (...or something)
  • Next by Date: Re: Accessor methods and (auto)release <Memory trail>
  • Previous by thread: Creator Code in Cocoa-Java App
  • Next by thread: Fwd: Metallic Windows ... Is Apple Breakin' the Rules?
  • Index(es):
    • Date
    • Thread