1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

Attempt to fix #4148 "Mac client gives inappropriate error if data volume is not mounted"

This commit is contained in:
Mitchell Livingston 2011-03-27 02:50:38 +00:00
parent 0db633378d
commit 836903956c

View file

@ -572,15 +572,19 @@ int trashDataFile(const char * filename)
if ([self allDownloaded] || ![fDefaults boolForKey: @"WarningRemainingSpace"])
return YES;
NSString * downloadFolder = [self currentDirectory], * volumeName;
if ((volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: downloadFolder] objectAtIndex: 0]))
NSString * downloadFolder = [self currentDirectory];
NSLog(@"%@", downloadFolder);
NSDictionary * systemAttributes;
if ((systemAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath: downloadFolder error: NULL]))
{
NSDictionary * systemAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath: downloadFolder error: NULL];
uint64_t remainingSpace = [[systemAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
NSLog(@"%@", systemAttributes);
const uint64_t remainingSpace = [[systemAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
//if the remaining space is greater than the size left, then there is enough space regardless of preallocation
if (remainingSpace < [self sizeLeft] && remainingSpace < tr_torrentGetBytesLeftToAllocate(fHandle))
{
NSString * volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: downloadFolder] objectAtIndex: 0];
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: [NSString stringWithFormat:
NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",