fs: Fix renaming files/folders destination path (fixes #116)

This commit is contained in:
Joel16 2022-08-07 14:17:01 -04:00
parent d07de640b3
commit 091328a840
2 changed files with 4 additions and 2 deletions

View File

@ -138,8 +138,9 @@ namespace FS {
bool Rename(FsDirectoryEntry &entry, const std::string &dest_path) {
std::string src_path = FS::BuildPath(entry);
std::string full_dest_path = FS::BuildPath(dest_path, true);
if (rename(src_path.c_str(), dest_path.c_str()) != 0) {
if (rename(src_path.c_str(), full_dest_path.c_str()) != 0) {
Log::Error("FS::Rename(%s, %s) failed.\n", src_path.c_str(), dest_path.c_str());
return false;
}

View File

@ -84,7 +84,8 @@ namespace Popups {
if (ImGui::Button(strings[cfg.lang][Lang::OptionsRename], ImVec2(200, 50))) {
std::string path = Keyboard::GetText(strings[cfg.lang][Lang::OptionsRenamePrompt], data.entries[data.selected].name);
if (R_SUCCEEDED(FS::Rename(data.entries[data.selected], path.c_str()))) {
if (FS::Rename(data.entries[data.selected], path.c_str())) {
Options::RefreshEntries(false);
sort = -1;
}