1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 00:34:04 +00:00

use NSFileManager for checking script existance

This commit is contained in:
Mitchell Livingston 2010-11-30 00:34:32 +00:00
parent c9af96eb43
commit cc8c2c686c

View file

@ -809,16 +809,13 @@ tr_session * fHandle;
- (void) setDoneScriptEnabled: (id) sender
{
if ([fDefaults boolForKey: @"DoneScriptEnabled"] && !fopen([[fDefaults stringForKey:@"DoneScriptPath"] UTF8String], "r"))
if ([fDefaults boolForKey: @"DoneScriptEnabled"] && ![[NSFileManager defaultManager] fileExistsAtPath: [fDefaults stringForKey:@"DoneScriptPath"]])
{
// enabled is set but script file doesn't exist, so prompt for one and disable until they pick one
[fDefaults setBool: NO forKey: @"DoneScriptEnabled"];
[self doneScriptSheetShow: sender];
}
else
{
tr_sessionSetTorrentDoneScriptEnabled(fHandle, [fDefaults boolForKey: @"DoneScriptEnabled"]);
}
}
- (void) setAutoImport: (id) sender
@ -1358,7 +1355,7 @@ tr_session * fHandle;
{
NSString * filePath = [[openPanel filenames] objectAtIndex: 0];
if (fopen([filePath UTF8String], "r")) // script file exists
if ([[NSFileManager defaultManager] fileExistsAtPath: filePath]) // script file exists
{
[fDefaults setObject: filePath forKey: @"DoneScriptPath"];
[fDefaults setBool: YES forKey: @"DoneScriptEnabled"];