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).
This commit is contained in:
euquiq 2020-08-04 14:24:16 -03:00
parent 41cecc88a1
commit bb264dcf57

View File

@ -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();
});