]> granicus.if.org Git - transmission/commitdiff
Attempt to fix #4148 "Mac client gives inappropriate error if data volume is not...
authorMitchell Livingston <livings124@transmissionbt.com>
Sun, 27 Mar 2011 02:50:38 +0000 (02:50 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Sun, 27 Mar 2011 02:50:38 +0000 (02:50 +0000)
macosx/Torrent.m

index 3c41570262f59a62cb40b0d79b59e611c5613d69..906e995d4485bbfc87b2e27d073543b4046cc602 100644 (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.",