fix: Do not check for writable provider to save project, disable shortcut when unavailable (#859)

* do not check for writable provider to save project

* disable save project shortcut when we can't save it

* log when project is saved
This commit is contained in:
Thomas
2023-01-07 17:16:43 +01:00
committed by GitHub
parent d86be9d9b3
commit ed831c6fc9
2 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
#include <hex/ui/view.hpp>
#include <hex/api/project_file_manager.hpp>
#include <hex/helpers/logger.hpp>
namespace hex::plugin::builtin {
@@ -15,8 +16,12 @@ namespace hex::plugin::builtin {
}
void saveProject() {
if (!ProjectFile::store()) {
View::showErrorPopup("hex.builtin.popup.error.project.save"_lang);
if (ImHexApi::Provider::isValid() && ProjectFile::hasPath()) {
if (!ProjectFile::store()) {
View::showErrorPopup("hex.builtin.popup.error.project.save"_lang);
} else {
log::debug("Project saved");
}
}
}

View File

@@ -77,7 +77,7 @@ namespace hex::plugin::builtin {
openProject();
}
if (ImGui::MenuItem("hex.builtin.menu.file.save_project"_lang, "ALT + S", false, providerValid && provider->isWritable() && ProjectFile::hasPath())) {
if (ImGui::MenuItem("hex.builtin.menu.file.save_project"_lang, "ALT + S", false, providerValid && ProjectFile::hasPath())) {
saveProject();
}