diff --git a/Utilities/Config.cpp b/Utilities/Config.cpp index 8be321335a..fbf15c9ccc 100644 --- a/Utilities/Config.cpp +++ b/Utilities/Config.cpp @@ -387,7 +387,7 @@ bool cfg::node::from_string(const std::string& value, bool dynamic) return true; } - cfg_log.fatal("Failed to load node: %s", error); + cfg_log.error("Failed to load node: %s", error); return false; } diff --git a/Utilities/bin_patch.cpp b/Utilities/bin_patch.cpp index b060651267..3a45d6c16a 100644 --- a/Utilities/bin_patch.cpp +++ b/Utilities/bin_patch.cpp @@ -1064,13 +1064,6 @@ void patch_engine::save_config(const patch_map& patches_map) const std::string path = get_patch_config_path(); patch_log.notice("Saving patch config file %s", path); - fs::file file(path, fs::rewrite); - if (!file) - { - patch_log.fatal("Failed to open patch config file %s (%s)", path, fs::g_tls_error); - return; - } - YAML::Emitter out; out << YAML::BeginMap; @@ -1134,7 +1127,12 @@ void patch_engine::save_config(const patch_map& patches_map) out << YAML::EndMap; - file.write(out.c_str(), out.size()); + fs::pending_file file(path); + + if (!file.file || (file.file.write(out.c_str(), out.size()), !file.commit())) + { + patch_log.error("Failed to create patch config file %s (%s)", path, fs::g_tls_error); + } } static void append_patches(patch_engine::patch_map& existing_patches, const patch_engine::patch_map& new_patches, usz& count, usz& total, std::stringstream* log_messages) diff --git a/rpcs3/Emu/Io/pad_config.cpp b/rpcs3/Emu/Io/pad_config.cpp index ba163a2eb8..65ed6833e4 100644 --- a/rpcs3/Emu/Io/pad_config.cpp +++ b/rpcs3/Emu/Io/pad_config.cpp @@ -68,11 +68,9 @@ void cfg_input::save(const std::string& title_id, const std::string& profile) co input_log.fatal("Failed to create path: %s (%s)", cfg_name, fs::g_tls_error); } - if (auto cfg_file = fs::file(cfg_name, fs::rewrite)) - { - cfg_file.write(to_string()); - } - else + fs::pending_file cfg_file(cfg_name); + + if (!cfg_file.file || (cfg_file.file.write(to_string()), !cfg_file.commit())) { input_log.error("Failed to save pad config to '%s'", cfg_name); } diff --git a/rpcs3/rpcs3qt/patch_manager_dialog.cpp b/rpcs3/rpcs3qt/patch_manager_dialog.cpp index 34ac3d47a8..a248191b3c 100644 --- a/rpcs3/rpcs3qt/patch_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/patch_manager_dialog.cpp @@ -982,11 +982,9 @@ bool patch_manager_dialog::handle_json(const QByteArray& data) } // Overwrite current patch file - if (fs::file patch_file = fs::file(path, fs::rewrite)) - { - patch_file.write(content); - } - else + fs::pending_file patch_file(path); + + if (!patch_file.file || (patch_file.file.write(content), !patch_file.commit())) { patch_log.error("Could not save new patches to %s (%s)", path, fs::g_tls_error); return false;