Skip to content

Commit 091328a

Browse files
committed
fs: Fix renaming files/folders destination path (fixes #116)
1 parent d07de64 commit 091328a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

source/fs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ namespace FS {
138138

139139
bool Rename(FsDirectoryEntry &entry, const std::string &dest_path) {
140140
std::string src_path = FS::BuildPath(entry);
141+
std::string full_dest_path = FS::BuildPath(dest_path, true);
141142

142-
if (rename(src_path.c_str(), dest_path.c_str()) != 0) {
143+
if (rename(src_path.c_str(), full_dest_path.c_str()) != 0) {
143144
Log::Error("FS::Rename(%s, %s) failed.\n", src_path.c_str(), dest_path.c_str());
144145
return false;
145146
}

source/popups/options.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ namespace Popups {
8484

8585
if (ImGui::Button(strings[cfg.lang][Lang::OptionsRename], ImVec2(200, 50))) {
8686
std::string path = Keyboard::GetText(strings[cfg.lang][Lang::OptionsRenamePrompt], data.entries[data.selected].name);
87-
if (R_SUCCEEDED(FS::Rename(data.entries[data.selected], path.c_str()))) {
87+
88+
if (FS::Rename(data.entries[data.selected], path.c_str())) {
8889
Options::RefreshEntries(false);
8990
sort = -1;
9091
}

0 commit comments

Comments
 (0)