1
0
mirror of synced 2025-01-19 01:24:15 +01:00

fix: Broken file open logic

Closes #1090
This commit is contained in:
WerWolv 2023-05-20 11:52:24 +02:00
parent 3e4c4430d5
commit 3cb8e37182

View File

@ -85,22 +85,25 @@ namespace hex::plugin::builtin {
EventManager::post<EventProviderOpened>(newProvider);
} else if (name == "Open File") {
fs::openFileBrowser(fs::DialogMode::Open, { }, [](const auto &path) {
if(path.extension() == ".hexproj"){
if (path.extension() == ".hexproj") {
if (!ProjectFile::load(path)) {
PopupError::open("hex.builtin.popup.error.project.load"_lang);
}
}else{
} else {
FileProvider* newProvider = static_cast<FileProvider*>(
ImHexApi::Provider::createProvider("hex.builtin.provider.file", true)
);
if (newProvider == nullptr)
return;
newProvider->setPath(path);
newProvider->open();
if (newProvider != nullptr && !newProvider->open())
if (!newProvider->open())
hex::ImHexApi::Provider::remove(newProvider);
else
EventManager::post<EventProviderOpened>(newProvider);
}
});
});
} else if (name == "Open Project") {
fs::openFileBrowser(fs::DialogMode::Open, { {"Project File", "hexproj"} },
[](const auto &path) {