mirror of https://github.com/WerWolv/ImHex.git
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:
parent
d86be9d9b3
commit
ed831c6fc9
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
#include <hex/ui/view.hpp>
|
#include <hex/ui/view.hpp>
|
||||||
#include <hex/api/project_file_manager.hpp>
|
#include <hex/api/project_file_manager.hpp>
|
||||||
|
#include <hex/helpers/logger.hpp>
|
||||||
|
|
||||||
|
|
||||||
namespace hex::plugin::builtin {
|
namespace hex::plugin::builtin {
|
||||||
|
@ -15,8 +16,12 @@ namespace hex::plugin::builtin {
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveProject() {
|
void saveProject() {
|
||||||
if (!ProjectFile::store()) {
|
if (ImHexApi::Provider::isValid() && ProjectFile::hasPath()) {
|
||||||
View::showErrorPopup("hex.builtin.popup.error.project.save"_lang);
|
if (!ProjectFile::store()) {
|
||||||
|
View::showErrorPopup("hex.builtin.popup.error.project.save"_lang);
|
||||||
|
} else {
|
||||||
|
log::debug("Project saved");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace hex::plugin::builtin {
|
||||||
openProject();
|
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();
|
saveProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue