From 836903956c3fb767c65d3336b6a7e24e6f59c5f7 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 27 Mar 2011 02:50:38 +0000 Subject: [PATCH] Attempt to fix #4148 "Mac client gives inappropriate error if data volume is not mounted" --- macosx/Torrent.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 3c4157026..906e995d4 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -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.",