summaryrefslogtreecommitdiffstats
path: root/osdep
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-28 21:39:56 +0200
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-05-30 23:01:12 +0200
commit3396e0565b39c5168777b78cc26ed3b985a81071 (patch)
tree2fe24dee44b92e0011ffd1a42e0dfd199160f1a6 /osdep
parent14ff6bbf7c69f1ba4c657754ce53a681c90d13c5 (diff)
downloadmpv-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.m21
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]) {