diff options
Diffstat (limited to 'platform/osx/os_osx.mm')
-rw-r--r-- | platform/osx/os_osx.mm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index f132ed9514..4ca89ff4b2 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -139,7 +139,6 @@ void OS_OSX::initialize() { } void OS_OSX::finalize() { - #ifdef COREMIDI_ENABLED midi_driver.close(); #endif @@ -261,10 +260,8 @@ String OS_OSX::get_system_dir(SystemDir p_dir) const { String ret; if (found) { - NSArray *paths = NSSearchPathForDirectoriesInDomains(id, NSUserDomainMask, YES); if (paths && [paths count] >= 1) { - char *utfs = strdup([[paths firstObject] UTF8String]); ret.parse_utf8(utfs); free(utfs); @@ -275,7 +272,13 @@ String OS_OSX::get_system_dir(SystemDir p_dir) const { } Error OS_OSX::shell_open(String p_uri) { - [[NSWorkspace sharedWorkspace] openURL:[[NSURL alloc] initWithString:[[NSString stringWithUTF8String:p_uri.utf8().get_data()] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]]; + NSString *string = [NSString stringWithUTF8String:p_uri.utf8().get_data()]; + NSURL *uri = [[NSURL alloc] initWithString:string]; + // Escape special characters in filenames + if (!uri || !uri.scheme || [uri.scheme isEqual:@"file"]) { + uri = [[NSURL alloc] initWithString:[string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]; + } + [[NSWorkspace sharedWorkspace] openURL:uri]; return OK; } |