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