diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-01-16 00:42:07 +0100 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-01-16 22:27:04 +0100 |
commit | 89a49ffd74f8be4ff36b0e6500e7b4434944c7fa (patch) | |
tree | 7d65e2c29b0984ac3c62d77510c433d22559b69b /video/out/osx_common.m | |
parent | 60755108a61d7ce2f5ff07226a689bde552be008 (diff) | |
download | mpv-89a49ffd74f8be4ff36b0e6500e7b4434944c7fa.tar.bz2 mpv-89a49ffd74f8be4ff36b0e6500e7b4434944c7fa.tar.xz |
osxbundle: cocoa_common: change playlist on fileopen events
When opening new files in Finder when `mpv` is running from an application
bundle, the new files will now replace the current playlist.
Fixes #14
Diffstat (limited to 'video/out/osx_common.m')
-rw-r--r-- | video/out/osx_common.m | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/video/out/osx_common.m b/video/out/osx_common.m index 58198c11e2..2d22fc52dc 100644 --- a/video/out/osx_common.m +++ b/video/out/osx_common.m @@ -152,3 +152,24 @@ cleanup_and_return: [pool release]; return rv; } + +struct escape_couple { + NSString *in; + NSString *out; +}; + +static struct escape_couple escapes[] = { + { @"\\", @"\\\\" }, + { @"\"", @"\\\"" }, + { NULL, NULL } +}; + +NSString *escape_loadfile_name(NSString *input) +{ + for (int i = 0; escapes[i].out; i++) { + input = [input stringByReplacingOccurrencesOfString:escapes[i].in + withString:escapes[i].out]; + } + + return input; +} |