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.",