• 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: creating a resource fork and writing raw bytes to it
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating a resource fork and writing raw bytes to it


  • Subject: Re: creating a resource fork and writing raw bytes to it
  • From: Mike Fischer <email@hidden>
  • Date: Wed, 21 May 2008 18:11:24 +0200

Am 21.05.2008 um 15:34 schrieb Nick Rogers <email@hidden>:

Hi,
My app has to create the resource fork of a file and then write raw
bytes picked up from the disk to it.

Unless these "raw bytes" actually contain a valid Resource Manager structure this would be a bad idea. Yes it is possible but a lot of applications (including the Finder I believe) assume that a resource fork contains Resource Manager data structures.



Is there any support in cocoa for this.

Not as far as I know. But you are free to use the File Manager (or the Resource Manager for that matter) in a "Cocoa"* app. If you are dealing with Resource data structures (as opposed to raw data) then a number of 3rd party classes exist. Search for NDResource by Nathan Day for example.


*) I don't get why people keep insisting on using only exactly one technology like for example Cocoa or Carbon? Every normal Cocoa app makes use of Carbon internally (the menu system for example) and most Carbon applications make use of Cocoa (font selection, file dialogs, ...). So generally speaking almost all modern applications use a mix of technologies. Yes, you might in theory be able to do every task with the "one-true-technology" of your choice but why, when another technology already has the solution?


For writing to the data fork I'm creating the file with NSFileManager
and then writing using write().

Using write() doesn't sound like a very "Cocoa" thing to do.


Is there any similar mechanism for creating resource fork.
Have googled a lot, but to no avail.

There are hacks that rely on special pathnames to access the resource fork of a file. (Something like /path/to/file/..namedfork/rsrc) But I would not recommend using them as there is no guarantee that they will continue to work in the future (or even now in the context of Cocoa file operations). Also they might only work on certain volume formats.



HTH Mike -- Mike Fischer Softwareentwicklung, EDV-Beratung Schulung, Vertrieb Note: I read this list in digest mode! Send me a private copy for faster responses.

_______________________________________________

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


  • Follow-Ups:
    • Re: creating a resource fork and writing raw bytes to it
      • From: Charles Srstka <email@hidden>
  • Prev by Date: connections and the nib lifecycle
  • Next by Date: Re: Cocoa et al as HCI usability problem
  • Previous by thread: Re: creating a resource fork and writing raw bytes to it
  • Next by thread: Re: creating a resource fork and writing raw bytes to it
  • Index(es):
    • Date
    • Thread