Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FS: Reshuffle Rename to fix steamrt unit test failure
Browse files Browse the repository at this point in the history
OatmealDome committed May 15, 2022
1 parent 8c59cf6 commit cd6f27d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Source/Core/Core/IOS/FS/HostBackend/FS.cpp
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit cd6f27d

Please sign in to comment.