Re: Get size of folder

2009-08-19 Thread Dave DeLong
Thanks for pointing that out, Bill. I was requesting the rsrc size but then never actually doing anything with it. I've got a better version now (which I've written as part of my efforts to create an open source "Super Get Info" replacement), which I explain in this SO.com post: http://s

Re: Get size of folder

2009-08-19 Thread Rainer Brockerhoff
At 21:54 -0700 18/08/09, cocoa-dev-requ...@lists.apple.com wrote: >From: PCWiz >Date: Tue, 18 Aug 2009 21:17:30 -0700 >Message-ID: <9c08262c-4924-4840-8ca3-f4548db20...@gmail.com> > >I need a good method to find the size of a file or folder exactly as displayed >in Finder. I've tried every method

Re: Get size of folder

2009-08-19 Thread Bill Monk
PCWiz wrote: The next thing I tried was using the Carbon File Manager API using this method by Dave DeLong: http://github.com/davedelong/BuildCleaner/blob/b2712242b4eea1fff0e78a08b393a417e3019c8a/NSFileManager+FileSize.m This method worked for some folders/files, but for others it returned wil

Re: Get size of folder

2009-08-19 Thread Jean-Daniel Dupas
It will returns what you ask for. Catalog info can contain physical data/rsrc size and logical data/rsrc size. Le 19 août 2009 à 18:07, Dave DeLong a écrit : Will those return the file sizes in 4KB block increments? Or will that return the actual byte size? PCWiz is looking for the forme

Re: Get size of folder

2009-08-19 Thread Dave DeLong
Will those return the file sizes in 4KB block increments? Or will that return the actual byte size? PCWiz is looking for the former. Dave On Aug 19, 2009, at 10:01 AM, Jean-Daniel Dupas wrote: Use The Core Services File Manager API : http://developer.apple.com/documentation/Performance/Co

Re: Get size of folder

2009-08-19 Thread Jean-Daniel Dupas
Le 19 août 2009 à 17:29, PCWiz a écrit : Hi, It would probably be a good idea to tell you guys some of the methods I have tried. First of all, I've tried just using NSFileManager and NSEnumerator to enumerate through the directory. This didn't add up resource forks AND it didn't round up

Re: Get size of folder

2009-08-19 Thread PCWiz
Hi, It would probably be a good idea to tell you guys some of the methods I have tried. First of all, I've tried just using NSFileManager and NSEnumerator to enumerate through the directory. This didn't add up resource forks AND it didn't round up the sizes to Finder's 4KB minimum block s

Re: Get size of folder

2009-08-19 Thread Sean McBride
On 8/19/09 11:23 AM, Alastair Houghton said: >Carbon is usually a good way to go, because you don't need to check >the volume caps first And in case people out there are thinking "oh no! Carbon! boo!"... Note that the 'File Manager' isn't actually part of Carbon.framework but rather CoreServices

Re: Get size of folder

2009-08-19 Thread Alastair Houghton
On 19 Aug 2009, at 11:14, Charles Srstka wrote: I just tried it with Shark, and it appears not to be using the standard BSD opendir and readdir APIs, but rather the proprietary to Apple (as far as I can tell) getdirentriesattr API, which actually does seem to have a man page now, which says

Re: Get size of folder

2009-08-19 Thread Alastair Houghton
On 19 Aug 2009, at 10:56, Jean-Daniel Dupas wrote: and that someone had benchmarked Cocoa vs. Carbon vs. BSD, and Carbon came out on top. What I didn't remember was that it was you who did it: The last time I saw this kind of benchmark, the BSD code were poorly implemented and did not use

Re: Get size of folder

2009-08-19 Thread Alastair Houghton
On 19 Aug 2009, at 10:47, Charles Srstka wrote: On Aug 19, 2009, at 4:24 AM, Alastair Houghton wrote: As I think I may have mentioned before, contrary to apparently widespread opinion, Carbon isn't magic. The Carbon file manager APIs are based on BSD APIs, and calling the BSD APIs in quest

Re: Get size of folder

2009-08-19 Thread Charles Srstka
On Aug 19, 2009, at 4:56 AM, Jean-Daniel Dupas wrote: If you don't believe Carbon use the BSD API, just do a simple File Manager based application, and check what append in Shark or other sampling software when you run it, or even better, use DTrace to check what syscall is used. I just t

Re: Get size of folder

2009-08-19 Thread Gregory Weston
PCWiz wrote: I need a good method to find the size of a file or folder exactly as displayed in Finder. I've tried every method I could find on the internet, from using the du shell utility with NSTask to using the Carbon file manager. I need something that will work under heavy load (processing

Re: Get size of folder

2009-08-19 Thread Jean-Daniel Dupas
Le 19 août 2009 à 11:47, Charles Srstka a écrit : On Aug 19, 2009, at 4:24 AM, Alastair Houghton wrote: As I think I may have mentioned before, contrary to apparently widespread opinion, Carbon isn't magic. The Carbon file manager APIs are based on BSD APIs, and calling the BSD APIs in qu

Re: Get size of folder

2009-08-19 Thread Charles Srstka
On Aug 19, 2009, at 4:24 AM, Alastair Houghton wrote: As I think I may have mentioned before, contrary to apparently widespread opinion, Carbon isn't magic. The Carbon file manager APIs are based on BSD APIs, and calling the BSD APIs in question is going to be faster if you really need hig

Re: Get size of folder

2009-08-19 Thread Alastair Houghton
On 19 Aug 2009, at 09:03, Charles Srstka wrote: On Aug 19, 2009, at 2:59 AM, Jean-Daniel Dupas wrote: I think you have to add data and resource sizes to match the Finder behavior (which are two distinct field in the catalog info). Ah, you're right. This probably makes Carbon's file manager

Re: Get size of folder

2009-08-19 Thread Charles Srstka
On Aug 19, 2009, at 2:59 AM, Jean-Daniel Dupas wrote: I think you have to add data and resource sizes to match the Finder behavior (which are two distinct field in the catalog info). Ah, you're right. This probably makes Carbon's file manager the most convenient way to do it (I believe it's

Re: Get size of folder

2009-08-19 Thread Jean-Daniel Dupas
Le 19 août 2009 à 09:52, Charles Srstka a écrit : On Aug 18, 2009, at 11:17 PM, PCWiz wrote: Hi, I need a good method to find the size of a file or folder exactly as displayed in Finder. I've tried every method I could find on the internet, from using the du shell utility with NSTask to

Re: Get size of folder

2009-08-19 Thread Charles Srstka
On Aug 18, 2009, at 11:17 PM, PCWiz wrote: Hi, I need a good method to find the size of a file or folder exactly as displayed in Finder. I've tried every method I could find on the internet, from using the du shell utility with NSTask to using the Carbon file manager. I need something tha

Get size of folder

2009-08-18 Thread PCWiz
Hi, I need a good method to find the size of a file or folder exactly as displayed in Finder. I've tried every method I could find on the internet, from using the du shell utility with NSTask to using the Carbon file manager. I need something that will work under heavy load (processing hu