1
0
mirror of synced 2024-11-14 11:07:43 +01:00

fix: ImHex failing to load in Portable mode from a folder with no permissions

Fixes #881
This commit is contained in:
WerWolv 2023-01-17 09:59:57 +01:00
parent a65f0a5238
commit 3ddef07284

View File

@ -474,13 +474,16 @@ namespace hex::plugin::builtin {
(void)EventManager::subscribe<EventProviderOpened>([](prv::Provider *provider) {
{
auto recentPath = fs::getDefaultPaths(fs::ImHexPath::Recent).front();
for (const auto &recentPath : fs::getDefaultPaths(fs::ImHexPath::Recent)) {
auto fileName = hex::format("{:%y%m%d_%H%M%S}.json", fmt::gmtime(std::chrono::system_clock::now()));
fs::File recentFile(recentPath / fileName, fs::File::Mode::Create);
if (!recentFile.isValid())
continue;
if (auto settings = provider->storeSettings(); !settings.is_null())
recentFile.write(settings.dump(4));
}
}
updateRecentProviders();
});