diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-02-09 08:27:36 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-02-09 08:27:55 +0200 |
commit | cc313a1c1c7fb5cffd46cd9c8a2125770b12dc5a (patch) | |
tree | 397c1764f571fb84c12a0419d2af1fb0d5b958e7 /platform/macos/os_macos.mm | |
parent | 41564aaf7708b0bf594f745dd2448a54dd687cc5 (diff) | |
download | redot-engine-cc313a1c1c7fb5cffd46cd9c8a2125770b12dc5a.tar.gz |
[macOS] Allow `open_shell` to handle filenames without `file://`.
Diffstat (limited to 'platform/macos/os_macos.mm')
-rw-r--r-- | platform/macos/os_macos.mm | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/platform/macos/os_macos.mm b/platform/macos/os_macos.mm index 56542aff37..000215ac46 100644 --- a/platform/macos/os_macos.mm +++ b/platform/macos/os_macos.mm @@ -356,8 +356,11 @@ Error OS_MacOS::shell_show_in_file_manager(String p_path, bool p_open_folder) { Error OS_MacOS::shell_open(String p_uri) { 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"]) { + // No scheme set, assume "file://" and escape special characters. + if (!p_uri.begins_with("file://")) { + string = [NSString stringWithUTF8String:("file://" + p_uri).utf8().get_data()]; + } uri = [[NSURL alloc] initWithString:[string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]; } [[NSWorkspace sharedWorkspace] openURL:uri]; |