From c06c249eeb15633c6c02f4e20a4874c4dea1a972 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 2 Jan 2025 23:12:16 +0100 Subject: [PATCH] Bootstrap: Flush pending writes before copying content files --- source/ui/installer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/ui/installer.cpp b/source/ui/installer.cpp index 0c20d0e..8e7af58 100644 --- a/source/ui/installer.cpp +++ b/source/ui/installer.cpp @@ -360,8 +360,11 @@ void InstallCIA(std::filesystem::path content_dir, spdlog::logger& logger, const const auto& ncch = ret.contents[content_index]; const auto& content_info = ret.tmd.content_infos.at(content_index); - std::ofstream out_file(content_dir / fmt::format("{:08x}.cxi", content_info.id)); - out_file.write(reinterpret_cast(ncch.data()), ncch.size()); + { + std::ofstream out_file(content_dir / fmt::format("{:08x}.cxi", content_info.id)); + out_file.write(reinterpret_cast(ncch.data()), ncch.size()); + // Close scope here to ensure data is flushed to disk + } // To simplify title launching, we always boot from 00000000.cxi currently. // Copy the main title to that location hence