diff options
author | bunnei <bunneidev@gmail.com> | 2021-01-24 22:42:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-24 22:42:51 +0100 |
commit | 44c5ea3639b648dbb3db8f6bcb06bff88436177b (patch) | |
tree | 0b35f01c4d0f9ec260a91e1273f069b5cd8ba143 | |
parent | Merge pull request #5814 from ReinUsesLisp/remove-rdna-dynstate (diff) | |
parent | vfs_real: When moving files or directories, don't assume file opening will succeed (diff) | |
download | yuzu-44c5ea3639b648dbb3db8f6bcb06bff88436177b.tar yuzu-44c5ea3639b648dbb3db8f6bcb06bff88436177b.tar.gz yuzu-44c5ea3639b648dbb3db8f6bcb06bff88436177b.tar.bz2 yuzu-44c5ea3639b648dbb3db8f6bcb06bff88436177b.tar.lz yuzu-44c5ea3639b648dbb3db8f6bcb06bff88436177b.tar.xz yuzu-44c5ea3639b648dbb3db8f6bcb06bff88436177b.tar.zst yuzu-44c5ea3639b648dbb3db8f6bcb06bff88436177b.zip |
-rw-r--r-- | src/core/file_sys/vfs_real.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index a287eebe3..a44ce6288 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -133,8 +133,11 @@ VirtualFile RealVfsFilesystem::MoveFile(std::string_view old_path_, std::string_ } cache.erase(old_path); - file->Open(new_path, "r+b"); - cache.insert_or_assign(new_path, std::move(file)); + if (file->Open(new_path, "r+b")) { + cache.insert_or_assign(new_path, std::move(file)); + } else { + LOG_ERROR(Service_FS, "Failed to open path {} in order to re-cache it", new_path); + } } else { UNREACHABLE(); return nullptr; @@ -214,9 +217,12 @@ VirtualDir RealVfsFilesystem::MoveDirectory(std::string_view old_path_, } auto file = cached.lock(); - file->Open(file_new_path, "r+b"); cache.erase(file_old_path); - cache.insert_or_assign(std::move(file_new_path), std::move(file)); + if (file->Open(file_new_path, "r+b")) { + cache.insert_or_assign(std::move(file_new_path), std::move(file)); + } else { + LOG_ERROR(Service_FS, "Failed to open path {} in order to re-cache it", file_new_path); + } } return OpenDirectory(new_path, Mode::ReadWrite); |