From 091328a8402198e1d045cf6ab7dcb178d8d61155 Mon Sep 17 00:00:00 2001 From: Joel16 Date: Sun, 7 Aug 2022 14:17:01 -0400 Subject: [PATCH] fs: Fix renaming files/folders destination path (fixes #116) --- source/fs.cpp | 3 ++- source/popups/options.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source/fs.cpp b/source/fs.cpp index be0e54b..6f90aa4 100644 --- a/source/fs.cpp +++ b/source/fs.cpp @@ -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; } diff --git a/source/popups/options.cpp b/source/popups/options.cpp index 721a603..585743d 100644 --- a/source/popups/options.cpp +++ b/source/popups/options.cpp @@ -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; }