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)) {
|
for (const auto &directory : fs::getDefaultPaths(fs::ImHexPath::Config)) {
|
||||||
auto path = directory / AchievementsFile;
|
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()) {
|
if (!file.isValid()) {
|
||||||
continue;
|
continue;
|
||||||
@ -234,7 +234,9 @@ namespace hex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file.writeString(json.dump(4));
|
auto result = json.dump(4);
|
||||||
|
file.setSize(0);
|
||||||
|
file.writeString(result);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,6 +318,7 @@ namespace hex::init {
|
|||||||
bool storeSettings() {
|
bool storeSettings() {
|
||||||
try {
|
try {
|
||||||
ContentRegistry::Settings::impl::store();
|
ContentRegistry::Settings::impl::store();
|
||||||
|
AchievementManager::storeProgress();
|
||||||
} catch (std::exception &e) {
|
} catch (std::exception &e) {
|
||||||
log::error("Failed to store configuration! {}", e.what());
|
log::error("Failed to store configuration! {}", e.what());
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user