Changeset 11444


Ignore:
Timestamp:
Nov 30, 2010, 12:34:32 AM (11 years ago)
Author:
livings124
Message:

use NSFileManager for checking script existance

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/PrefsController.m

    r11433 r11444  
    810810- (void) setDoneScriptEnabled: (id) sender
    811811{
    812     if ([fDefaults boolForKey: @"DoneScriptEnabled"] && !fopen([[fDefaults stringForKey:@"DoneScriptPath"] UTF8String], "r"))
     812    if ([fDefaults boolForKey: @"DoneScriptEnabled"] && ![[NSFileManager defaultManager] fileExistsAtPath: [fDefaults stringForKey:@"DoneScriptPath"]])
    813813    {
    814814        // enabled is set but script file doesn't exist, so prompt for one and disable until they pick one
     
    816816        [self doneScriptSheetShow: sender];
    817817    }
    818     else
    819     {
    820         tr_sessionSetTorrentDoneScriptEnabled(fHandle, [fDefaults boolForKey: @"DoneScriptEnabled"]);
    821     }
     818    tr_sessionSetTorrentDoneScriptEnabled(fHandle, [fDefaults boolForKey: @"DoneScriptEnabled"]);
    822819}
    823820
     
    13591356        NSString * filePath = [[openPanel filenames] objectAtIndex: 0];
    13601357       
    1361         if (fopen([filePath UTF8String], "r")) // script file exists
     1358        if ([[NSFileManager defaultManager] fileExistsAtPath: filePath]) // script file exists
    13621359        {
    13631360            [fDefaults setObject: filePath forKey: @"DoneScriptPath"];
Note: See TracChangeset for help on using the changeset viewer.