Atomically overwrite games.yml

Reduce chances of losing information.
This commit is contained in:
Nekotekina 2020-06-07 22:20:43 +03:00
parent 3d7c38ff9d
commit bfee541540

View File

@ -1202,7 +1202,8 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
games[m_title_id] = bdvd_dir;
YAML::Emitter out;
out << games;
fs::file(fs::get_config_dir() + "/games.yml", fs::rewrite).write(out.c_str(), out.size());
fs::file(fs::get_config_dir() + "/_tmp_games.yml", fs::rewrite).write(out.c_str(), out.size());
fs::rename(fs::get_config_dir() + "/_tmp_games.yml", fs::get_config_dir() + "/games.yml", true);
}
else if (m_cat == "1P" && from_hdd0_game)
{