From dd5e63abd3ae9c0849a886a766e7b73d20b521ca Mon Sep 17 00:00:00 2001 From: Rascafr Date: Fri, 11 Sep 2020 12:25:10 +0200 Subject: [PATCH] Hide empty & .dot tmp / system files in freq manager --- firmware/application/apps/ui_fileman.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/application/apps/ui_fileman.cpp b/firmware/application/apps/ui_fileman.cpp index f19cee3c..8fd0a5b6 100644 --- a/firmware/application/apps/ui_fileman.cpp +++ b/firmware/application/apps/ui_fileman.cpp @@ -41,10 +41,12 @@ void FileManBaseView::load_directory_contents(const std::filesystem::path& dir_p // List directories and files, put directories up top if (dir_path.string().length()) entry_list.push_back({ u"..", 0, true }); - + for (const auto& entry : std::filesystem::directory_iterator(dir_path, u"*")) { - if (std::filesystem::is_regular_file(entry.status())) { - if (entry.path().string().length()) { + + // do not display dir / files starting with '.' (hidden / tmp) + if (entry.path().string().length() && entry.path().filename().string()[0] != '.') { + if (std::filesystem::is_regular_file(entry.status())) { bool matched = true; if (filtering) { auto entry_extension = entry.path().extension().string(); @@ -58,9 +60,9 @@ void FileManBaseView::load_directory_contents(const std::filesystem::path& dir_p if (matched) entry_list.push_back({ entry.path(), (uint32_t)entry.size(), false }); + } else if (std::filesystem::is_directory(entry.status())) { + entry_list.insert(entry_list.begin(), { entry.path(), 0, true }); } - } else if (std::filesystem::is_directory(entry.status())) { - entry_list.insert(entry_list.begin(), { entry.path(), 0, true }); } } }