summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-12 08:26:47 +0200
committerwm4 <wm4@nowhere>2013-09-13 22:04:47 +0200
commit2e5610c23a1f43856d9554d7821c2f2ae0fe91f2 (patch)
tree4653627b08a2e1420cdacba1806717340be4ca75
parentc472782c3e73fa7e41faec6de2cfcba6e6c28f13 (diff)
downloadmpv-2e5610c23a1f43856d9554d7821c2f2ae0fe91f2.tar.bz2
mpv-2e5610c23a1f43856d9554d7821c2f2ae0fe91f2.tar.xz
macosx_application: fix file opening on OS X 10.9 (hopefully)
File opening through Finder, apparently drops `--psn` arguments on Mavericks and just uses no args. Modify the code to account for that case. This wasn't tested on 10.9 itself (I don't have a paid dev account), but it *should* work if I understood the problem correctly.
-rw-r--r--osdep/macosx_application.m11
1 files changed, 10 insertions, 1 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index d04b2ccdea..ab1dcf4483 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -432,11 +432,20 @@ static bool psn_matches_current_process(char *psn_arg_to_check)
return [real_psn isEqualToString:in_psn];
}
+static bool bundle_started_from_finder(int argc, char **argv)
+{
+ bool bundle_detected = [[NSBundle mainBundle] bundleIdentifier];
+ bool pre_mavericks_args = argc==2 && psn_matches_current_process(argv[1]);
+ bool post_mavericks_args = argc==0;
+
+ return bundle_detected && (pre_mavericks_args || post_mavericks_args);
+}
+
void macosx_finder_args_preinit(int *argc, char ***argv)
{
Application *app = mpv_shared_app();
- if (*argc==2 && psn_matches_current_process((*argv)[1])) {
+ if (bundle_started_from_finder(*argc, *argv)) {
macosx_redirect_output_to_logfile("mpv");
macosx_wait_fileopen_events();