From bb264dcf57e061bf9cfd4cda77d3387695168ed6 Mon Sep 17 00:00:00 2001
From: euquiq <31453004+euquiq@users.noreply.github.com>
Date: Tue, 4 Aug 2020 14:24:16 -0300
Subject: [PATCH] fixes file renaming on subdir

The file rename function needs to be called with full_path/old_name  and full_path/new_name.

Instead, it was called with full_path/old_name and new_name ... thus the renamed file ended on the root dir (path not preserved).
---
 firmware/application/apps/ui_fileman.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/firmware/application/apps/ui_fileman.cpp b/firmware/application/apps/ui_fileman.cpp
index 74438e32..f19cee3c 100644
--- a/firmware/application/apps/ui_fileman.cpp
+++ b/firmware/application/apps/ui_fileman.cpp
@@ -249,7 +249,11 @@ FileLoadView::FileLoadView(
 
 void FileManagerView::on_rename(NavigationView& nav) {
 	text_prompt(nav, name_buffer, max_filename_length, [this](std::string& buffer) {
-		rename_file(get_selected_path(), buffer);
+		std::string destination_path = current_path.string();
+		if (destination_path.back() != '/')
+			destination_path += '/';
+		destination_path = destination_path + buffer;
+		rename_file(get_selected_path(), destination_path);
 		load_directory_contents(current_path);
 		refresh_list();
 	});
-- 
GitLab