diff --git a/firmware/application/apps/ui_fileman.cpp b/firmware/application/apps/ui_fileman.cpp index 7c1fcfbe..1787b70a 100644 --- a/firmware/application/apps/ui_fileman.cpp +++ b/firmware/application/apps/ui_fileman.cpp @@ -20,9 +20,10 @@ * Boston, MA 02110-1301, USA. */ -/* BUGS: - * - OOM/paging menu items - * - Using UI with empty SD card +/* TODO: + * - Paging menu items + * - UI with empty SD card + * - Copy/Move */ #include @@ -328,7 +329,7 @@ FileLoadView::FileLoadView( on_select_entry = [this](KeyEvent) { if (get_selected_entry().is_directory) { - current_path /= get_selected_entry().path; + current_path = get_selected_full_path(); reload_current(); } else { nav_.pop(); @@ -354,20 +355,17 @@ void FileManagerView::on_rename() { text_prompt(nav_, name_buffer, cursor_pos, max_filename_length, [this, &entry](std::string& renamed) { auto renamed_path = fs::path{ renamed }; - bool has_partner = false; rename_file(get_selected_full_path(), current_path / renamed_path); - if (iequal(renamed_path.extension(), entry.path.extension())) { - has_partner = partner_file_prompt(nav_, entry.path, "Rename", - [this, renamed_path](const fs::path& partner, bool should_rename) mutable { - if (should_rename) { - auto new_name = renamed_path.replace_extension(partner.extension()); - rename_file(current_path / partner, current_path / new_name); - } - reload_current(); + auto has_partner = partner_file_prompt(nav_, entry.path, "Rename", + [this, renamed_path](const fs::path& partner, bool should_rename) mutable { + if (should_rename) { + auto new_name = renamed_path.replace_extension(partner.extension()); + rename_file(current_path / partner, current_path / new_name); } - ); - } + reload_current(); + } + ); if (!has_partner) reload_current(); diff --git a/firmware/application/apps/ui_fileman.hpp b/firmware/application/apps/ui_fileman.hpp index d0894b53..87cc8d11 100644 --- a/firmware/application/apps/ui_fileman.hpp +++ b/firmware/application/apps/ui_fileman.hpp @@ -163,12 +163,12 @@ private: }; Button button_rename { - { 0 * 8, 29 * 8, 9 * 8, 32 }, + { 0 * 8, 29 * 8, 14 * 8, 32 }, "Rename" }; Button button_delete { - { 21 * 8, 29 * 8, 9 * 8, 32 }, + { 16 * 8, 29 * 8, 14 * 8, 32 }, "Delete" }; diff --git a/firmware/application/file.hpp b/firmware/application/file.hpp index 4fd99af2..a023c7b3 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -154,7 +154,7 @@ struct path { path& operator/=(const path& p) { if (_s.back() != preferred_separator) - _s + preferred_separator; + _s += preferred_separator; _s += p._s; return *this; }