From 972c0dcb4a0c18a81e44c72e4f53c41f0159712b Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 29 Sep 2022 08:20:30 +0300 Subject: [PATCH] hide layouts folder in badusb app --- applications/main/bad_usb/scenes/bad_usb_scene_file_select.c | 1 + applications/services/gui/modules/file_browser_worker.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c index 9eb225fd1..53e5ecc7b 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c @@ -8,6 +8,7 @@ static bool bad_usb_file_select(BadUsbApp* bad_usb) { DialogsFileBrowserOptions browser_options; dialog_file_browser_set_basic_options( &browser_options, BAD_USB_APP_SCRIPT_EXTENSION, &I_badusb_10px); + browser_options.skip_assets = true; // Input events and views are managed by file_browser bool res = dialog_file_browser_show( diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 36df6cc83..a316a0779 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -13,6 +13,7 @@ #define TAG "BrowserWorker" #define ASSETS_DIR "assets" +#define BADUSB_LAYOUTS_DIR "layouts" #define BROWSER_ROOT STORAGE_ANY_PATH_PREFIX #define FILE_NAME_LEN_MAX 256 #define LONG_LOAD_THRESHOLD 100 @@ -78,7 +79,8 @@ static bool browser_filter_by_name(BrowserWorker* browser, string_t name, bool i if(is_folder) { // Skip assets folders (if enabled) if(browser->skip_assets) { - return ((string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)); + return ((string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)) && + ((string_cmp_str(name, BADUSB_LAYOUTS_DIR) == 0) ? (false) : (true)); } else { return true; }