Changeset 9187


Ignore:
Timestamp:
Sep 26, 2009, 8:13:15 PM (12 years ago)
Author:
livings124
Message:

#2398 Check if save path exists before generating torrent file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/CreatorWindowController.m

    r9151 r9187  
    378378- (void) createReal
    379379{
     380    //check if the location currently exists
     381    if (![[NSFileManager defaultManager] fileExistsAtPath: [fLocation stringByDeletingLastPathComponent]])
     382    {
     383        NSArray * pathComponents = [fLocation pathComponents];
     384        NSInteger count = [pathComponents count];
     385       
     386        NSAlert * alert = [[[NSAlert alloc] init] autorelease];
     387        [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> directory doesn't exist warning -> button")];
     388        [alert setMessageText: NSLocalizedString(@"The chosen torrent file location does not exist.",
     389                                                "Create torrent -> directory doesn't exist warning -> title")];
     390        [alert setInformativeText: [NSString stringWithFormat:
     391                NSLocalizedString(@"The directory \"%@\" does not currently exist. "
     392                    "Create this directory or choose a different one to create the torrent file.",
     393                    "Create torrent -> directory doesn't exist warning -> warning"),
     394                    [fLocation stringByDeletingLastPathComponent]]];
     395        [alert setAlertStyle: NSWarningAlertStyle];
     396       
     397        [alert beginSheetModalForWindow: [self window] modalDelegate: self didEndSelector: nil contextInfo: nil];
     398        return;
     399    }
     400   
    380401    //check if a file with the same name and location already exists
    381402    if ([[NSFileManager defaultManager] fileExistsAtPath: fLocation])
Note: See TracChangeset for help on using the changeset viewer.