Changeset 3305


Ignore:
Timestamp:
Oct 7, 2007, 3:28:06 AM (15 years ago)
Author:
livings124
Message:

factor in only checked files when determining if there is enough remaining space

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Torrent.h

    r3259 r3305  
    132132- (NSString *) name;
    133133- (uint64_t) size;
     134- (uint64_t) sizeLeft;
    134135- (NSString *) trackerAddress;
    135136- (NSString *) trackerAddressAnnounce;
  • trunk/macosx/Torrent.m

    r3283 r3305  
    486486        uint64_t remainingSpace = [[systemAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
    487487       
    488         uint64_t existingSize = 0;
    489         NSDirectoryEnumerator * enumerator;
    490         if ((enumerator = [[NSFileManager defaultManager] enumeratorAtPath:
    491                     [[self downloadFolder] stringByAppendingPathComponent: [self name]]]))
    492         {
    493             NSDictionary * fileAttributes;
    494             while ([enumerator nextObject])
    495             {
    496                 fileAttributes = [enumerator fileAttributes];
    497                 if (![[fileAttributes objectForKey: NSFileType] isEqualTo: NSFileTypeDirectory])
    498                     existingSize += [[fileAttributes objectForKey: NSFileSize] unsignedLongLongValue];
    499             }
    500         }
    501        
    502         #warning factor in checked files
    503         if (remainingSpace + existingSize <= [self size])
     488        if (remainingSpace - [self sizeLeft] <= [self size])
    504489        {
    505490            NSAlert * alert = [[NSAlert alloc] init];
     
    626611}
    627612
     613- (uint64_t) sizeLeft
     614{
     615    return fStat->leftUntilDone;
     616}
     617
    628618- (NSString *) trackerAddress
    629619{
     
    704694- (float) progressLeft
    705695{//NSLog(@"left %f",(float)fStat->leftUntilDone / [self size]);
    706     return (float)fStat->leftUntilDone / [self size];
     696    return (float)[self sizeLeft] / [self size];
    707697}
    708698
     
    834824            uint64_t have = [self haveTotal];
    835825            string = [NSString stringWithFormat: NSLocalizedString(@"%@ of %@ selected (%.2f%%)", "Torrent -> progress string"),
    836                             [NSString stringForFileSize: have], [NSString stringForFileSize: have + fStat->leftUntilDone],
     826                            [NSString stringForFileSize: have], [NSString stringForFileSize: have + [self sizeLeft]],
    837827                            100.0 * [self progressDone]];
    838828        }
Note: See TracChangeset for help on using the changeset viewer.