mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
be96a25dad
commit
86c05655d4
|
@ -425,11 +425,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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue