1
0
mirror of synced 2025-01-18 00:56:49 +01:00

impr: Harden achievement progress store function

This commit is contained in:
WerWolv 2023-12-27 16:57:44 +01:00
parent 874619f62e
commit 3c6f52f5ea
2 changed files with 5 additions and 2 deletions

View File

@ -218,7 +218,7 @@ namespace hex {
for (const auto &directory : fs::getDefaultPaths(fs::ImHexPath::Config)) {
auto path = directory / AchievementsFile;
wolv::io::File file(path, wolv::io::File::Mode::Create);
wolv::io::File file(path, wolv::io::File::Mode::Write);
if (!file.isValid()) {
continue;
@ -234,7 +234,9 @@ namespace hex {
}
}
file.writeString(json.dump(4));
auto result = json.dump(4);
file.setSize(0);
file.writeString(result);
break;
}
}

View File

@ -318,6 +318,7 @@ namespace hex::init {
bool storeSettings() {
try {
ContentRegistry::Settings::impl::store();
AchievementManager::storeProgress();
} catch (std::exception &e) {
log::error("Failed to store configuration! {}", e.what());
return false;