From 6583ad6970fc673d6de9bbdc7b2a7d4ee2850759 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 1 Dec 2014 21:29:32 +0100 Subject: [PATCH] cocoa: fix opening reference URLs (.file/id=) Fixes #1202 /cc @mpv-player/stable --- osdep/macosx_events.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osdep/macosx_events.m b/osdep/macosx_events.m index 7d0302114b..fcbfd46042 100644 --- a/osdep/macosx_events.m +++ b/osdep/macosx_events.m @@ -440,8 +440,10 @@ void cocoa_set_input_context(struct input_ctx *input_context) size_t num_files = [files count]; char **files_utf8 = talloc_array(NULL, char*, num_files); [files enumerateObjectsUsingBlock:^(id obj, NSUInteger i, BOOL *_){ - char *filename = (char *)[obj UTF8String]; - size_t bytes = [obj lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; + NSURL *url = [NSURL URLWithString:obj]; + NSString *path = [url path]; + char *filename = (char *)[path UTF8String]; + size_t bytes = [path lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; files_utf8[i] = talloc_memdup(files_utf8, filename, bytes + 1); }]; mp_event_drop_files(_inputContext, num_files, files_utf8);