mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
Attempt to fix #4148 "Mac client gives inappropriate error if data volume is not mounted"
This commit is contained in:
parent
0db633378d
commit
836903956c
1 changed files with 8 additions and 4 deletions
|
@ -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.",
|
||||
|
|
Loading…
Reference in a new issue