Display an error if saving of the log file fails.

This commit is contained in:
Mitchell Livingston 2006-08-24 02:41:12 +00:00
parent e4480f7a97
commit c5394700e0
3 changed files with 14 additions and 3 deletions

View File

@ -847,8 +847,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
{
NSAlert * alert = [[NSAlert alloc] init];
[alert addButtonWithTitle: @"OK"];
[alert setMessageText: [NSString stringWithFormat:
@"Copy of \"%@\" Cannot Be Created", [torrent name]]];
[alert setMessageText: [NSString stringWithFormat: @"Copy of \"%@\" Cannot Be Created", [torrent name]]];
[alert setInformativeText: [NSString stringWithFormat:
@"The torrent file (%@) cannot be found.", [torrent torrentLocation]]];
[alert setAlertStyle: NSWarningAlertStyle];

View File

@ -170,7 +170,19 @@
- (void) writeToFileSheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (NSString *) string
{
if (code == NSOKButton)
[string writeToFile: [panel filename] atomically: YES encoding: NSUTF8StringEncoding error: nil];
{
if (![string writeToFile: [panel filename] atomically: YES encoding: NSUTF8StringEncoding error: nil])
{
NSAlert * alert = [[NSAlert alloc] init];
[alert addButtonWithTitle: @"OK"];
[alert setMessageText: [NSString stringWithFormat: @"Log Could Not Be Saved"]];
[alert setInformativeText: [NSString stringWithFormat:
@"There was a problem creating the file \"%@\".", [[panel filename] lastPathComponent]]];
[alert setAlertStyle: NSWarningAlertStyle];
[alert runModal];
}
}
[string release];
}