From 3396e0565b39c5168777b78cc26ed3b985a81071 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 28 May 2013 21:39:56 +0200 Subject: macosx_application: move escape_loadfile_name in this file This allows to move back osx_common to raw C. --- osdep/macosx_application.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'osdep') 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]) { -- cgit v1.2.3