diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-11-18 23:57:50 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-11-18 23:57:50 +0000 |
commit | 3f11234f767748cefc04ec42de6008954359b19d (patch) | |
tree | 73fb6ae32940285ac024f30f5aa2d8a10776c089 /Source/SPStringAdditions.m | |
parent | 7449035e027814b807764d59ecd2428dbb43319d (diff) | |
download | sequelpro-3f11234f767748cefc04ec42de6008954359b19d.tar.gz sequelpro-3f11234f767748cefc04ec42de6008954359b19d.tar.bz2 sequelpro-3f11234f767748cefc04ec42de6008954359b19d.zip |
• further work on Bundle Editor
• generalised [NSString runBashCommand...]
Diffstat (limited to 'Source/SPStringAdditions.m')
-rw-r--r-- | Source/SPStringAdditions.m | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/Source/SPStringAdditions.m b/Source/SPStringAdditions.m index 3198f2ff..4e2b114b 100644 --- a/Source/SPStringAdditions.m +++ b/Source/SPStringAdditions.m @@ -469,25 +469,23 @@ // Furthermore this id is used to communicate with the called command as file name. NSString *processID = [NSString stringWithNewUUID]; [theEnv setObject:processID forKey:@"SP_PROCESS_ID"]; - id doc = [[[NSApp mainWindow] delegate] selectedTableDocument]; - if(!doc) { - NSBeep(); - NSLog(@"No active document found for bash command."); - return; + id doc = nil; + if([[[NSApp mainWindow] delegate] respondsToSelector:@selector(selectedTableDocument)]) + doc = [[[NSApp mainWindow] delegate] selectedTableDocument]; + if(doc != nil) { + [doc setProcessID:processID]; + + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryInputPathHeader, processID] forKey:@"SP_QUERY_FILE_PATH"]; + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultPathHeader, processID] forKey:@"SP_QUERY_RESULT_FILE_PATH"]; + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultStatusPathHeader, processID] forKey:@"SP_QUERY_RESULT_STATUS_FILE_PATH"]; + [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultMetaPathHeader, processID] forKey:@"SP_QUERY_RESULT_META_FILE_PATH"]; + + if([doc shellVariables]) + [theEnv addEntriesFromDictionary:[doc shellVariables]]; + + if(theEnv != nil && [theEnv count]) + [bashTask setEnvironment:theEnv]; } - [doc setProcessID:processID]; - - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryInputPathHeader, processID] forKey:@"SP_QUERY_FILE_PATH"]; - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultPathHeader, processID] forKey:@"SP_QUERY_RESULT_FILE_PATH"]; - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultStatusPathHeader, processID] forKey:@"SP_QUERY_RESULT_STATUS_FILE_PATH"]; - [theEnv setObject:[NSString stringWithFormat:@"%@%@", SPURLSchemeQueryResultMetaPathHeader, processID] forKey:@"SP_QUERY_RESULT_META_FILE_PATH"]; - - if([doc shellVariables]) - [theEnv addEntriesFromDictionary:[doc shellVariables]]; - - if(theEnv != nil && [theEnv count]) - [bashTask setEnvironment:theEnv]; - if(path != nil) [bashTask setCurrentDirectoryPath:path]; else if([shellEnvironment objectForKey:@"SP_BUNDLE_PATH"] && [[NSFileManager defaultManager] fileExistsAtPath:[shellEnvironment objectForKey:@"SP_BUNDLE_PATH"] isDirectory:&isDir] && isDir) |