diff options
| author | JMC47 <JMC4789@gmail.com> | 2020-04-18 06:50:59 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-18 06:50:59 -0400 |
| commit | 2d8758daaa2e07a7fbfc4a17d5cb089b27a6d10c (patch) | |
| tree | 4200c54de2ccf79c7500a5d6eddc74cf79cc3a7d /Source/Core | |
| parent | 21e3e14d8a9866028149bb41a9769d06209765fe (diff) | |
| parent | b2cf106ae9dfeb7c2ce853b793386d995d032ef1 (diff) | |
Merge pull request #8750 from leoetlino/close-before-rename
IOS/FS: Fix FST write failure on some platforms
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/IOS/FS/HostBackend/FS.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index fea5d16261..8859be7474 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -177,9 +177,17 @@ void HostFileSystem::SaveFst() const std::string dest_path = GetFstFilePath(); const std::string temp_path = File::GetTempFilenameForAtomicWrite(dest_path); - File::IOFile file{temp_path, "wb"}; - if (!file.WriteArray(to_write.data(), to_write.size()) || !File::Rename(temp_path, dest_path)) - ERROR_LOG(IOS_FS, "Failed to write new FST"); + { + // This temporary file must be closed before it can be renamed. + File::IOFile file{temp_path, "wb"}; + if (!file.WriteArray(to_write.data(), to_write.size())) + { + PanicAlert("IOS_FS: Failed to write new FST"); + return; + } + } + if (!File::Rename(temp_path, dest_path)) + PanicAlert("IOS_FS: Failed to rename temporary FST file"); } HostFileSystem::FstEntry* HostFileSystem::GetFstEntryForPath(const std::string& path) |
