remove NSLogs.

This commit is contained in:
Kelvin Sherlock 2011-03-03 22:48:06 -05:00
parent 72920be1e7
commit 5edc2cee6c
2 changed files with 35 additions and 25 deletions

View File

@ -39,7 +39,7 @@
NSURL *url = [[panel URLs] lastObject]; NSURL *url = [[panel URLs] lastObject];
NSString *path = [url isFileURL] ? [url path] : nil; NSString *path = [url isFileURL] ? [url path] : nil;
NSLog(@"%d %@", (int)result, path); //NSLog(@"%d %@", (int)result, path);
if (path) if (path)
{ {

View File

@ -56,7 +56,7 @@ static const char *TagToFormat(NSInteger tag)
- (void)dealloc - (void)dealloc
{ {
NSLog(@"%s %@", sel_getName(_cmd), self); //NSLog(@"%s %@", sel_getName(_cmd), self);
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
@ -185,25 +185,34 @@ static const char *TagToFormat(NSInteger tag)
-(void)runTask -(void)runTask
{ {
NSTask *task;
NSPipe *pipe = [NSPipe pipe]; NSPipe *pipe = [NSPipe pipe];
NSString *launchPath; NSString *launchPath;
NSArray *argv; NSArray *argv;
NSFileHandle *handle;
NSNotificationCenter *nc; NSNotificationCenter *nc;
NSString *exe;
task = [[NSTask alloc] init]; _task = [[NSTask alloc] init];
[task setStandardError: pipe]; [_task setStandardError: pipe];
[task setStandardOutput: pipe]; [_task setStandardOutput: pipe];
[task setStandardInput: [NSFileHandle fileHandleWithNullDevice]]; [_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: argv = [NSArray arrayWithObjects:
@"-r", @"-r",
@ -213,36 +222,33 @@ static const char *TagToFormat(NSInteger tag)
[task setLaunchPath: launchPath]; [_task setLaunchPath: launchPath];
[task setArguments: argv]; [_task setArguments: argv];
[self appendString: launchPath]; [self appendString: launchPath];
for (NSString *string in argv) for (NSString *string in argv)
{ {
[self appendString: string];
[self appendString: @" "]; [self appendString: @" "];
[self appendString: string];
} }
[self appendString: @"\n\n"]; [self appendString: @"\n\n"];
return;
nc = [NSNotificationCenter defaultCenter]; nc = [NSNotificationCenter defaultCenter];
[nc addObserver: self [nc addObserver: self
selector: @selector(taskComplete:) selector: @selector(taskComplete:)
name: NSTaskDidTerminateNotification name: NSTaskDidTerminateNotification
object: task]; object: _task];
[nc addObserver: self [nc addObserver: self
selector: @selector(readComplete:) selector: @selector(readComplete:)
name: NSFileHandleReadCompletionNotification name: NSFileHandleReadCompletionNotification
object: handle]; object: _handle];
_task = task; [_task launch];
_handle = [handle retain]; [_handle readInBackgroundAndNotify];
[task launch];
[handle readInBackgroundAndNotify];
} }
@ -269,7 +275,7 @@ static const char *TagToFormat(NSInteger tag)
-(void)taskComplete: (NSNotification *)notification -(void)taskComplete: (NSNotification *)notification
{ {
BOOL ok = NO;
NSTaskTerminationReason reason; NSTaskTerminationReason reason;
int status; int status;
NSString *string = nil; NSString *string = nil;
@ -280,7 +286,11 @@ static const char *TagToFormat(NSInteger tag)
if (reason == NSTaskTerminationReasonExit) 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 string = @"\n\n[An error occurred]\n\n";
} }
else else
@ -297,7 +307,7 @@ static const char *TagToFormat(NSInteger tag)
[_task release]; [_task release];
_task = nil; _task = nil;
[_mountButton setEnabled: YES]; if (!ok) [_mountButton setEnabled: YES];
} }
#pragma mark - #pragma mark -