mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
fix: Opening files on macOS through the Open with... option
Fixes #1070
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user