summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-19 22:03:49 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-09-19 22:03:49 +0200
commit061b6ab3aaf08e3f1ff65b19efca940ed43e7db2 (patch)
treeef603a5a844e4b667c70ae38c70362255edf0301 /osdep
parent00d8e8537372467c72308e5c895dc08985d4da02 (diff)
downloadmpv-061b6ab3aaf08e3f1ff65b19efca940ed43e7db2.tar.bz2
mpv-061b6ab3aaf08e3f1ff65b19efca940ed43e7db2.tar.xz
macosx_application: fix regression causing crash
95a2151d1 introduced a crash on systems lower than 10.9 when opening files with a single argument.
Diffstat (limited to 'osdep')
-rw-r--r--osdep/macosx_application.m13
1 files changed, 11 insertions, 2 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m
index 3f12454c9b..7e6ab963eb 100644
--- a/osdep/macosx_application.m
+++ b/osdep/macosx_application.m
@@ -439,13 +439,22 @@ static void get_system_version(int* major, int* minor, int* bugfix)
*bugfix = s_bugfix;
}
+static bool is_psn_argument(char *psn_arg_to_check)
+{
+ NSString *psn_arg = [NSString stringWithUTF8String:psn_arg_to_check];
+ return [psn_arg hasPrefix:@"-psn_"];
+}
+
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 finder_args = ((major == 10) && (minor >= 9)) ? argc==1 : argc==2;
- return bundle_detected && finder_args;
+ if ((major == 10) && (minor >= 9)) {
+ return bundle_detected && argc==1;
+ } else {
+ return bundle_detected && argc==2 && is_psn_argument(argv[1]);
+ }
}
void macosx_finder_args_preinit(int *argc, char ***argv)