Re: glitch in my size code?
Re: glitch in my size code?
- Subject: Re: glitch in my size code?
- From: "cricket ." <email@hidden>
- Date: Mon, 10 May 2004 14:35:58 -0700
If you were to step through the code in Xcode or gdb, you would quickly
find that what you are assigning to the 'file' variable are filenames,
not full paths. Learning how to step through code will help you solve
an amazing number of what seem like bizarrely weird problems.
- cricket
On May 10, 2004, at 1:23 PM, email@hidden wrote:
ok so this is the directory enumerator code i'm using
NSString *file;
NSDirectoryEnumerator *enumerator = [[NSFileManager
defaultManager] enumeratorAtPath:[object
stringByExpandingTildeInPath]];
while (file = [enumerator nextObject])
{
if (![[[file lastPathComponent] substringToIndex:1]
isEqualToString:@"."])
{
NSNumber *totalFileSize;
NSDictionary *fileSize = [manager
fileAttributesAtPath:file traverseLink:YES];
if (totalFileSize = [fileSize
objectForKey:NSFileSize])
total += [totalFileSize intValue];
NSLog(@"%@ - Total: %d",file,[totalFileSize
intValue]);
}
}
and this is what it returns??
2004-05-10 13:19:40.881 RU[560] ABPerson.index - Total: 0
2004-05-10 13:19:40.882 RU[560] ABPerson.skIndex - Total: 0
2004-05-10 13:19:40.882 RU[560] AddressBook.data - Total: 0
2004-05-10 13:19:40.882 RU[560] AddressBook.data.beforesave - Total: 0
2004-05-10 13:19:40.883 RU[560] AddressBook.data.previous - Total: 0
2004-05-10 13:19:40.884 RU[560] Images - Total: 0
2004-05-10 13:19:40.884 RU[560]
Images/04E2B77A-6111-11D8-B407-000A9577D556 - Total: 0
2004-05-10 13:19:40.885 RU[560]
Images/04EE7574-6111-11D8-B407-000A9577D556 - Total: 0
2004-05-10 13:19:40.885 RU[560]
Images/3A84D5B2-694F-11D8-8A10-000A9577D556 - Total: 0
2004-05-10 13:19:40.885 RU[560]
Images/3AC2EAD4-694F-11D8-8A10-000A9577D556 - Total: 0
2004-05-10 13:19:40.886 RU[560] Images/CachedMacDotComPhotos - Total: 0
all sizes are 0 which cant be right the total is 1.9 MB? what a i
doing wrong?
_______________________________________________
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.