• 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: Calculating file size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calculating file size


  • Subject: Re: Calculating file size
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Mon, 28 Apr 2008 12:08:48 +0200


Le 28 avr. 08 à 11:27, Gerriet M. Denkmann a écrit :


On 28 Apr 2008, at 07:44, email@hidden wrote:


Others have answered with good suggestions for other APIs, but I will
point out for the record that you can do it in Cocoa, too, because the
file system has a path-based mechanism in which "..namedfork/rsrc" is
appended to the path. For example, in Terminal:


$ ls -li Documents//Example.doc
108 -rw-r--r--@ 1 aburgh  aburgh  23552 Apr 27  2006 Documents/
Example.doc

$ ls  -li Documents/Example.doc/..namedfork/rsrc
108 -rw-r--r--  1 aburgh  aburgh  286 Apr 27  2006 Documents/
Example.doc/..namedfork/rsrc

Notice that the "inode" is the same (the Catalog Node ID on HFS+), but
size reflects the different forks. You can use this technique from
any program that lets you specify a path, such as command line
utilities, and you can even read and write the contents of the forks
this way. This is documented in the Mac OS X system documentation.

Where exactly?
I have found a mention of "namedfork" in man RezWack and some #defines in /usr/include/sys/paths.h - but no other documentation.



Kind regards,

Gerriet.


Relying on the ..namedfork "hack" is not a good idea. The way it handles other FS than HFS changed a lot between major version. It's not documented and may disapear in the futur.
If you do not have any requirement (using BSD API for example) you should use the CoreServices File Manager or other "high-level" API. That the most reliable way to do what you want.



_______________________________________________

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


References: 
 >Re: Calculating file size (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: How is "Apple + Ctrl + D" implemented?
  • Next by Date: Re: edit file
  • Previous by thread: Re: Calculating file size
  • Next by thread: Re: Calculating file size
  • Index(es):
    • Date
    • Thread