fix: Opening files on macOS through the Open with... option

Fixes #1070
This commit is contained in:
WerWolv 2024-02-23 20:17:33 +01:00
parent 85ec807417
commit 75c03d56d2
2 changed files with 5 additions and 0 deletions

View file

@ -679,6 +679,7 @@ namespace hex {
static std::optional<std::fs::path> fileToOpen;
extern "C" void openFile(const char *path) {
log::info("Opening file: {0}", path);
fileToOpen = path;
}

View file

@ -74,6 +74,10 @@
NSString* urlString = [url absoluteString];
const char* utf8String = [urlString UTF8String];
const char *prefix = "file://";
if (strncmp(utf8String, prefix, strlen(prefix)) == 0)
utf8String += strlen(prefix);
openFile(utf8String);
return YES;