Merge pull request #116 from euquiq/fix-filemanager-rename-placing-file-on-root

fixes file renaming on subdir
This commit is contained in:
Erwin Ried 2020-08-04 19:45:45 +02:00 committed by GitHub
commit 62821a79e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -249,7 +249,11 @@ FileLoadView::FileLoadView(
void FileManagerView::on_rename(NavigationView& nav) { void FileManagerView::on_rename(NavigationView& nav) {
text_prompt(nav, name_buffer, max_filename_length, [this](std::string& buffer) { 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); load_directory_contents(current_path);
refresh_list(); refresh_list();
}); });