cocoa: fix opening quarantined files on 10.9 with the bundle

It looks like on Mavericks the Finder is passing different arguments to mpv
depending on whether the opened file is quarantined or not.

Fixes #285
This commit is contained in:
Stefano Pigozzi
2013-11-02 19:01:42 +01:00
committed by wm4
parent 31cdb96474
commit ea17adcd66
+7 -2
View File
@@ -463,10 +463,15 @@ static bool bundle_started_from_finder(int argc, char **argv)
bool bundle_detected = [[NSBundle mainBundle] bundleIdentifier];
int major, minor, bugfix;
get_system_version(&major, &minor, &bugfix);
bool with_psn = bundle_detected && argc==1;
bool without_psn = bundle_detected && argc==2 && is_psn_argument(argv[1]);
if ((major == 10) && (minor >= 9)) {
return bundle_detected && argc==1;
// Looks like opening quarantined files from the finder inserts the
// -psn argument while normal files do not. Hurr.
return with_psn || without_psn;
} else {
return bundle_detected && argc==2 && is_psn_argument(argv[1]);
return with_psn;
}
}