1
0
mirror of synced 2025-02-17 18:59:21 +01:00

fix: Make sure crash backup doesn't end up in recents list

This commit is contained in:
WerWolv 2023-06-02 11:03:44 +02:00
parent 504c022f01
commit 62ecfb0e0e
3 changed files with 8 additions and 2 deletions

View File

@ -49,6 +49,7 @@
"hex.builtin.common.open": "Open",
"hex.builtin.common.percentage": "Percentage",
"hex.builtin.common.processing": "Processing",
"hex.builtin.common.project": "Project",
"hex.builtin.common.question": "Question",
"hex.builtin.common.range": "Range",
"hex.builtin.common.range.entire_data": "Entire Data",

View File

@ -480,7 +480,7 @@ namespace hex::plugin::builtin {
editor.setProvider(dataProvider.get());
}
if (ImGui::BeginChild("##editor", scaled(ImVec2(600, 400)))) {
if (ImGui::BeginChild("##editor", scaled(ImVec2(600, 400)), false, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
editor.draw();
ImGui::EndChild();

View File

@ -18,6 +18,7 @@
namespace hex::plugin::builtin::recent {
constexpr static auto MaxRecentEntries = 5;
constexpr static auto BackupFileName = "crash_backup.hexproj";
static std::atomic<bool> s_recentEntriesUpdating = false;
static std::list<RecentEntry> s_recentEntries;
@ -57,13 +58,17 @@ namespace hex::plugin::builtin::recent {
if (ContentRegistry::Settings::read("hex.builtin.setting.general", "hex.builtin.setting.general.save_recent_providers", 1) == 1) {
auto fileName = hex::format("{:%y%m%d_%H%M%S}.json", fmt::gmtime(std::chrono::system_clock::now()));
auto projectFileName = ProjectFile::getPath().filename();
if (projectFileName == BackupFileName)
return;
// The recent provider is saved to every "recent" directory
for (const auto &recentPath : fs::getDefaultPaths(fs::ImHexPath::Recent)) {
wolv::io::File recentFile(recentPath / fileName, wolv::io::File::Mode::Create);
if (!recentFile.isValid())
continue;
std::string displayName = hex::format("[Project] {}", wolv::util::toUTF8String(ProjectFile::getPath().filename()));
std::string displayName = hex::format("[{}] {}", "hex.builtin.common.project"_lang, wolv::util::toUTF8String(projectFileName));
nlohmann::json recentEntry {
{"type", "project"},