fix: ImHex failing to load in Portable mode from a folder with no permissions
Fixes #881
This commit is contained in:
parent
a65f0a5238
commit
3ddef07284
@ -474,12 +474,15 @@ namespace hex::plugin::builtin {
|
||||
|
||||
(void)EventManager::subscribe<EventProviderOpened>([](prv::Provider *provider) {
|
||||
{
|
||||
auto recentPath = fs::getDefaultPaths(fs::ImHexPath::Recent).front();
|
||||
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);
|
||||
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));
|
||||
if (auto settings = provider->storeSettings(); !settings.is_null())
|
||||
recentFile.write(settings.dump(4));
|
||||
}
|
||||
}
|
||||
|
||||
updateRecentProviders();
|
||||
|
Loading…
Reference in New Issue
Block a user