diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-05-28 21:39:56 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-05-30 23:01:12 +0200 |
commit | 3396e0565b39c5168777b78cc26ed3b985a81071 (patch) | |
tree | 2fe24dee44b92e0011ffd1a42e0dfd199160f1a6 /osdep | |
parent | 14ff6bbf7c69f1ba4c657754ce53a681c90d13c5 (diff) | |
download | mpv-3396e0565b39c5168777b78cc26ed3b985a81071.tar.bz2 mpv-3396e0565b39c5168777b78cc26ed3b985a81071.tar.xz |
macosx_application: move escape_loadfile_name in this file
This allows to move back osx_common to raw C.
Diffstat (limited to 'osdep')
-rw-r--r-- | osdep/macosx_application.m | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/osdep/macosx_application.m b/osdep/macosx_application.m index e57b6545b0..6d2d5e03e2 100644 --- a/osdep/macosx_application.m +++ b/osdep/macosx_application.m @@ -59,6 +59,27 @@ static pthread_t playback_thread_id; @synthesize keyFIFO = _key_fifo; @synthesize menuItems = _menu_items; +struct escape_couple { + NSString *in; + NSString *out; +}; + +static struct escape_couple escapes[] = { + { @"\\", @"\\\\" }, + { @"\"", @"\\\"" }, + { NULL, NULL } +}; + +static 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; +} + - (id)init { if (self = [super init]) { |