From 1c53d2c12302d6c11de0bc9af6746ec322e68959 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 26 Mar 2022 16:34:29 +0100 Subject: [PATCH] ux: Automatically remove recently opened file entries if the file doesn't exist anymore --- plugins/builtin/source/content/welcome_screen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/builtin/source/content/welcome_screen.cpp b/plugins/builtin/source/content/welcome_screen.cpp index 1b7bac7fa..f83403d20 100644 --- a/plugins/builtin/source/content/welcome_screen.cpp +++ b/plugins/builtin/source/content/welcome_screen.cpp @@ -468,8 +468,11 @@ namespace hex::plugin::builtin { } } - for (const auto &path : ContentRegistry::Settings::read("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.recent_files")) - s_recentFilePaths.emplace_back(std::u8string(path.begin(), path.end())); + for (const auto &pathString : ContentRegistry::Settings::read("hex.builtin.setting.imhex", "hex.builtin.setting.imhex.recent_files")) { + std::fs::path path = std::u8string(pathString.begin(), pathString.end()); + if (fs::exists(path)) + s_recentFilePaths.emplace_back(path); + } if (ImHexApi::System::getInitArguments().contains("tip-of-the-day")) { s_tipOfTheDay = ImHexApi::System::getInitArguments()["tip-of-the-day"];