diff options
author | ritsuka <[email protected]> | 2015-07-04 07:02:19 +0000 |
---|---|---|
committer | ritsuka <[email protected]> | 2015-07-04 07:02:19 +0000 |
commit | b77948c513aea1fb4168ac886e6901de93d1c083 (patch) | |
tree | 19807c3edea5db975ed16fc558c29c937358e56b /macosx | |
parent | 531019695973690af79b3648688284ba936f902d (diff) |
MacGui: use NSWorkspace to open an encoded file in the external app. It doesn't block like main thread unlike NSAppleScript.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7337 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/HBQueueController.m | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/macosx/HBQueueController.m b/macosx/HBQueueController.m index 406611df7..241dd64f0 100644 --- a/macosx/HBQueueController.m +++ b/macosx/HBQueueController.m @@ -673,14 +673,21 @@ - (void)sendToExternalApp:(NSURL *)fileURL { // This end of encode action is called as each encode rolls off of the queue - if([[NSUserDefaults standardUserDefaults] boolForKey: @"sendToMetaX"] == YES) + if ([[NSUserDefaults standardUserDefaults] boolForKey:@"sendToMetaX"] == YES) { - NSString *sendToApp = [[NSUserDefaults standardUserDefaults] objectForKey:@"SendCompletedEncodeToApp"]; - if (![sendToApp isEqualToString:@"None"]) + NSWorkspace *workspace = [NSWorkspace sharedWorkspace]; + NSString *sendToApp = [workspace fullPathForApplication:[[NSUserDefaults standardUserDefaults] objectForKey:@"SendCompletedEncodeToApp"]]; + + if (sendToApp) + { + if (![workspace openFile:fileURL.path withApplication:sendToApp]) + { + [HBUtilities writeToActivityLog:"Failed to send file to: %s", sendToApp]; + } + } + else { - [HBUtilities writeToActivityLog: "trying to send encode to: %s", [sendToApp UTF8String]]; - NSAppleScript *myScript = [[NSAppleScript alloc] initWithSource: [NSString stringWithFormat: @"%@%@%@%@%@", @"tell application \"",sendToApp,@"\" to open (POSIX file \"", fileURL.path, @"\")"]]; - [myScript executeAndReturnError: nil]; + [HBUtilities writeToActivityLog:"Send file to: app not found"]; } } } |