1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-22 14:10:34 +00:00

lazily call tr_torrentGetBytesLeftToAllocate()

This commit is contained in:
Mitchell Livingston 2008-11-05 13:09:39 +00:00
parent db2ca16cf4
commit bc3159f4ac

View file

@ -550,10 +550,10 @@ void completenessChangeCallback(tr_torrent * torrent, tr_completeness status, vo
NSDictionary * systemAttributes = onLeopard ? [fileManager attributesOfFileSystemForPath: downloadFolder error: NULL]
: [fileManager fileSystemAttributesAtPath: downloadFolder];
uint64_t remainingSpace = [[systemAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue],
neededSpace = tr_torrentGetBytesLeftToAllocate(fHandle);
uint64_t remainingSpace = [[systemAttributes objectForKey: NSFileSystemFreeSize] unsignedLongLongValue];
if (remainingSpace < neededSpace)
//if the size left is less then remaining space, then there is enough space regardless of preallocation
if (remainingSpace < [self sizeLeft] && remainingSpace < tr_torrentGetBytesLeftToAllocate(fHandle))
{
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: [NSString stringWithFormat: