From df22439826997b29e7ec587c13c4beb0862bce58 Mon Sep 17 00:00:00 2001 From: OatmealDome Date: Sun, 15 May 2022 04:02:01 -0400 Subject: [PATCH] FS: Reshuffle Rename to fix steamrt unit test failure --- Source/Core/Core/IOS/FS/HostBackend/FS.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index ef1e983b2a..27daeeafb1 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -552,16 +552,20 @@ ResultCode HostFileSystem::Rename(Uid uid, Gid gid, const std::string& old_path, } } - // Finally, remove the child from the old parent and move it to the new parent. FstEntry* new_entry = GetFstEntryForPath(new_path); + new_entry->name = split_new_path.file_name; + + // Finally, remove the child from the old parent and move it to the new parent. const auto it = std::find_if(old_parent->children.begin(), old_parent->children.end(), GetNamePredicate(split_old_path.file_name)); if (it != old_parent->children.end()) { - *new_entry = *it; + new_entry->data = it->data; + new_entry->children = it->children; + old_parent->children.erase(it); } - new_entry->name = split_new_path.file_name; + SaveFst(); return ResultCode::Success;