Re: Size of a bundle (or directory)
Re: Size of a bundle (or directory)
- Subject: Re: Size of a bundle (or directory)
- From: Christopher Corbell <email@hidden>
- Date: Thu, 27 Mar 2003 12:30:20 -0800
This NSFileManager approach appears to just give the same results
as
ls -l
on a directory; it gives the size of the directory record itself, it
does not
include the size of its contents. NSFileManager (like the shell)
appears
to treat a bundle as just another directory.
Does one really have to iterate through all of the bundle's contents
to get the total size? The finder sometimes lags when calculating a
large
directory size so I suspect this, but on the other hand I've
never seen a lag when getting info on a bundle, even when the
bundle was fairly large... so I was hoping there was a nice API
for this somewhere...
Thanks for any more suggestions,
Christopher
On Thursday, March 27, 2003, at 11:05 AM, Brian Ganninger wrote:
NSFileManger is probably your best bet to get the information you're
looking
for.
NSDictionary *dictionary = [[NSFileManager defaultManager]
fileAttributesAtPath:bundlePath traverseLink:NO];
NSNumber *bundleSize = [dictionary objectForKey:NSFileSize];
This is untested but should work or give a close stab at getting there.
Hope this helps.
- Brian Gannigner
On 3/27/03 12:34 PM, "Christopher Corbell" <email@hidden>
wrote:
Given an NSBundle (created with a known path), does anyone know
of an easy way to determine its total size?
I haven't been able to find this either in the NSBundle API or in
any POSIX api (total size of a directory's contents).
It's easy to Get Info for this information in the Finder, but I'd
like to be able to programatically get a number or, at least, a
line of text from the shell.
Thanks for any help,
Christopher
_______________________________________________
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.
----
" An Apple a day keeps the PC away."
" Ever notice that Apples fall from the sky while computers get thrown
out
Windows?"
_______________________________________________
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.
_______________________________________________
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.