impr: Handle macOS Open with... correctly

This commit is contained in:
WerWolv
2023-05-15 18:07:49 +02:00
parent 07565eea63
commit 14341d611d
3 changed files with 13 additions and 1 deletions

View File

@@ -283,4 +283,6 @@ namespace hex {
return string.substr(0, maxLength - 3) + "...";
}
std::optional<std::fs::path> getInitialFilePath();
}

View File

@@ -502,8 +502,13 @@ namespace hex {
return value;
}
static std::optional<std::fs::path> fileToOpen;
extern "C" void openFile(const char *path) {
hex::EventManager::post<RequestOpenFile>(path);
fileToOpen = path;
}
std::optional<std::fs::path> getInitialFilePath() {
return fileToOpen;
}
}