impr: Harden achievement progress store function
This commit is contained in:
parent
874619f62e
commit
3c6f52f5ea
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user