From 5edc2cee6c343835240e19152109eb197e129bab Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 3 Mar 2011 22:48:06 -0500 Subject: [PATCH] remove NSLogs. --- Image Opener/Image_OpenerAppDelegate.m | 2 +- Image Opener/WindowController.m | 58 +++++++++++++++----------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/Image Opener/Image_OpenerAppDelegate.m b/Image Opener/Image_OpenerAppDelegate.m index 9605754..c61c128 100644 --- a/Image Opener/Image_OpenerAppDelegate.m +++ b/Image Opener/Image_OpenerAppDelegate.m @@ -39,7 +39,7 @@ NSURL *url = [[panel URLs] lastObject]; NSString *path = [url isFileURL] ? [url path] : nil; - NSLog(@"%d %@", (int)result, path); + //NSLog(@"%d %@", (int)result, path); if (path) { diff --git a/Image Opener/WindowController.m b/Image Opener/WindowController.m index 1ade498..2706fbd 100644 --- a/Image Opener/WindowController.m +++ b/Image Opener/WindowController.m @@ -56,7 +56,7 @@ static const char *TagToFormat(NSInteger tag) - (void)dealloc { - NSLog(@"%s %@", sel_getName(_cmd), self); + //NSLog(@"%s %@", sel_getName(_cmd), self); NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; @@ -185,25 +185,34 @@ static const char *TagToFormat(NSInteger tag) -(void)runTask { - NSTask *task; NSPipe *pipe = [NSPipe pipe]; NSString *launchPath; NSArray *argv; - NSFileHandle *handle; NSNotificationCenter *nc; + NSString *exe; - task = [[NSTask alloc] init]; + _task = [[NSTask alloc] init]; - [task setStandardError: pipe]; - [task setStandardOutput: pipe]; - [task setStandardInput: [NSFileHandle fileHandleWithNullDevice]]; + [_task setStandardError: pipe]; + [_task setStandardOutput: pipe]; + [_task setStandardInput: [NSFileHandle fileHandleWithNullDevice]]; - handle = [pipe fileHandleForReading]; + _handle = [[pipe fileHandleForReading] retain]; - launchPath = @"launch path..."; + switch ([_fsMatrix selectedTag]) + { + case 1: + default: + exe = @"profuse"; + break; + case 2: + exe = @"fuse_pascal"; + break; + } - launchPath = [[NSBundle mainBundle] pathForAuxiliaryExecutable: @"profuse"]; + launchPath = [[NSBundle mainBundle] pathForAuxiliaryExecutable: exe]; + argv = [NSArray arrayWithObjects: @"-r", @@ -213,36 +222,33 @@ static const char *TagToFormat(NSInteger tag) - [task setLaunchPath: launchPath]; - [task setArguments: argv]; + [_task setLaunchPath: launchPath]; + [_task setArguments: argv]; [self appendString: launchPath]; + for (NSString *string in argv) { - [self appendString: string]; [self appendString: @" "]; + [self appendString: string]; } [self appendString: @"\n\n"]; - return; - nc = [NSNotificationCenter defaultCenter]; [nc addObserver: self selector: @selector(taskComplete:) name: NSTaskDidTerminateNotification - object: task]; + object: _task]; [nc addObserver: self selector: @selector(readComplete:) name: NSFileHandleReadCompletionNotification - object: handle]; + object: _handle]; - _task = task; - _handle = [handle retain]; - [task launch]; - [handle readInBackgroundAndNotify]; + [_task launch]; + [_handle readInBackgroundAndNotify]; } @@ -269,7 +275,7 @@ static const char *TagToFormat(NSInteger tag) -(void)taskComplete: (NSNotification *)notification { - + BOOL ok = NO; NSTaskTerminationReason reason; int status; NSString *string = nil; @@ -280,7 +286,11 @@ static const char *TagToFormat(NSInteger tag) if (reason == NSTaskTerminationReasonExit) { - if (status == 0) string = @"\n\n[Success]\n\n"; + if (status == 0) + { + string = @"\n\n[Success]\n\n"; + ok = YES; + } else string = @"\n\n[An error occurred]\n\n"; } else @@ -297,7 +307,7 @@ static const char *TagToFormat(NSInteger tag) [_task release]; _task = nil; - [_mountButton setEnabled: YES]; + if (!ok) [_mountButton setEnabled: YES]; } #pragma mark -