Ignore:
Timestamp:
Jun 30, 2007, 9:53:45 PM (15 years ago)
Author:
livings124
Message:

get rid of a warning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.m

    r2251 r2255  
    819819        return YES;
    820820   
    821     NSString * volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: [self downloadFolder]]
    822                                                                                                 objectAtIndex: 0];
    823     NSDictionary * fsAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath: [self downloadFolder]];
    824     uint64_t remainingSpace = [[fsAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue],
    825             torrentRemaining = fStat->left;
    826    
    827     if (volumeName && remainingSpace <= torrentRemaining)
    828     {
    829         NSAlert * alert = [[NSAlert alloc] init];
    830         [alert setMessageText: [NSString stringWithFormat:
    831                                 NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",
    832                                     "Torrent file disk space alert -> title"), [self name]]];
    833         [alert setInformativeText: [NSString stringWithFormat:
    834                         NSLocalizedString(@"The transfer will be paused. Clear up space on \"%@\" to continue.",
    835                                             "Torrent file disk space alert -> message"), volumeName]];
    836         [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
    837         [alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
    838         [alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
    839        
    840         int result = [alert runModal];
    841         [alert release];
    842        
    843         if (result == NSAlertThirdButtonReturn)
    844             [fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
    845        
    846         return result != NSAlertFirstButtonReturn;
     821    NSString * volumeName;
     822    if ((volumeName = [[[NSFileManager defaultManager] componentsToDisplayForPath: [self downloadFolder]] objectAtIndex: 0]))
     823    {
     824        NSDictionary * fsAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath: [self downloadFolder]];
     825        uint64_t remainingSpace = [[fsAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
     826       
     827        if (remainingSpace <= fStat->left)
     828        {
     829            NSAlert * alert = [[NSAlert alloc] init];
     830            [alert setMessageText: [NSString stringWithFormat:
     831                                    NSLocalizedString(@"Not enough remaining disk space to download \"%@\" completely.",
     832                                        "Torrent file disk space alert -> title"), [self name]]];
     833            [alert setInformativeText: [NSString stringWithFormat:
     834                            NSLocalizedString(@"The transfer will be paused. Clear up space on \"%@\" to continue.",
     835                                                "Torrent file disk space alert -> message"), volumeName]];
     836            [alert addButtonWithTitle: NSLocalizedString(@"OK", "Torrent file disk space alert -> button")];
     837            [alert addButtonWithTitle: NSLocalizedString(@"Download Anyway", "Torrent file disk space alert -> button")];
     838            [alert addButtonWithTitle: NSLocalizedString(@"Always Download", "Torrent file disk space alert -> button")];
     839           
     840            int result = [alert runModal];
     841            [alert release];
     842           
     843            if (result == NSAlertThirdButtonReturn)
     844                [fDefaults setBool: NO forKey: @"WarningRemainingSpace"];
     845           
     846            return result != NSAlertFirstButtonReturn;
     847        }
    847848    }
    848849    return YES;
     
    14441445}
    14451446
    1446 - (tr_info_t *) torrentInfo
     1447- (const tr_info_t *) torrentInfo
    14471448{
    14481449    return fInfo;
Note: See TracChangeset for help on using the changeset viewer.