show an error when moving the file fails

This commit is contained in:
Mitchell Livingston 2007-05-10 23:50:28 +00:00
parent 894c606162
commit e7687c676d
2 changed files with 28 additions and 12 deletions

View File

@ -37,5 +37,6 @@
+ (NSString *) stringForRatio: (float) ratio; + (NSString *) stringForRatio: (float) ratio;
- (NSComparisonResult) compareIP: (NSString *) string; - (NSComparisonResult) compareIP: (NSString *) string;
- (NSComparisonResult) clientCompare: (NSString *) string;
@end @end

View File

@ -740,9 +740,9 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
tr_setDownloadLimit(fHandle, 0); tr_setDownloadLimit(fHandle, 0);
tr_setUploadLimit(fHandle, 0); tr_setUploadLimit(fHandle, 0);
[[NSFileManager defaultManager] movePath: [oldFolder stringByAppendingPathComponent: [self name]] if ([[NSFileManager defaultManager] movePath: [oldFolder stringByAppendingPathComponent: [self name]]
toPath: [folder stringByAppendingPathComponent: [self name]] handler: nil]; toPath: [folder stringByAppendingPathComponent: [self name]] handler: nil])
{
//get rid of both incomplete folder and old download folder, even if move failed //get rid of both incomplete folder and old download folder, even if move failed
fUseIncompleteFolder = NO; fUseIncompleteFolder = NO;
if (fIncompleteFolder) if (fIncompleteFolder)
@ -756,6 +756,21 @@ static uint32_t kRed = BE(0xFF6450FF), //255, 100, 80
[self updateSpeedSetting]; [self updateSpeedSetting];
} }
else
{
[self updateSpeedSetting]; //restart before showing the alert
NSAlert * alert = [[NSAlert alloc] init];
[alert setMessageText: NSLocalizedString(@"There was an error moving the data file.", "Move error alert -> title")];
[alert setInformativeText: [NSString stringWithFormat:
NSLocalizedString(@"The move operation of \"%@\" cannot be done.",
" Move error alert -> message"), [self name]]];
[alert addButtonWithTitle: NSLocalizedString(@"OK", "Move error alert -> button")];
[alert runModal];
[alert release];
}
}
} }
- (void) copyTorrentFileTo: (NSString *) path - (void) copyTorrentFileTo: (NSString *) path