Problems getting free disk space
Problems getting free disk space
- Subject: Problems getting free disk space
- From: Jeff Holland <email@hidden>
- Date: Wed, 4 Sep 2002 18:38:19 -0700
Hello,
Has anyone else had any problems with the values returned from
NSFileManager's fileSystemAttributesAtPath? In my method that checks
for sufficient disk space (in abbreviated form below), the values
returned for NSFileSystemFreeSize seem incorrect. ('path1' is on an
external firewire hard drive, 'path2' is my Desktop folder.) My
firewire drive certainly has more free space than my internal drive,
but NSFileSystemFreeSize reports the opposite. The same thing happens
when I try NSFileSystemSize. However, NSFileSystemNodes and
NSFileSystemFreeNodes seem to show more correct results.
Any idea what's going on here? Is this a bug? Could it be due to a
potential problem with my filesystem?
Any help would be appreciated.
Thanks,
-jeff
- (BOOL)checkAvailableDiskSpace
{
NSFileManager *manager = [NSFileManager defaultManager];
NSDictionary *fsSrcAttrs = [manager fileSystemAttributesAtPath:[self
path1]];
NSDictionary *fsDestAttrs = [manager fileSystemAttributesAtPath:[self
path2]];
unsigned int srcSize = [[fsSrcAttrs objectForKey:NSFileSystemFreeSize]
unsignedIntValue];
unsigned int destSize = [[fsDestAttrs
objectForKey:NSFileSystemFreeSize] unsignedIntValue];
NSLog(@"%@ - %u", [self path1], srcSize);
NSLog(@"%@ - %u", [self path2], destSize);
return (destSize > srcSize) ? YES : NO;
}
--
Either war is obsolete or men are.
- Buckminster Fuller
_______________________________________________
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.