From 934ccec91b4afa8bd353a82786867bc729d1f427 Mon Sep 17 00:00:00 2001 From: WillyJL Date: Sat, 23 Aug 2025 22:59:23 +0200 Subject: [PATCH] Archive: Back out right away for main menu dirs --- applications/main/archive/archive.c | 5 +++-- .../main/archive/helpers/archive_browser.c | 15 ++++++++++++--- .../main/archive/helpers/archive_browser.h | 3 ++- .../main/archive/views/archive_browser_view.h | 1 + 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/applications/main/archive/archive.c b/applications/main/archive/archive.c index 5d50ff27a..62ed63156 100644 --- a/applications/main/archive/archive.c +++ b/applications/main/archive/archive.c @@ -147,13 +147,14 @@ int32_t archive_app(void* p) { if(path && !furi_string_empty(path)) { archive_set_tab(archive->browser, ArchiveTabBrowser); furi_string_set(archive->browser->path, path); - archive->browser->is_root = false; + archive->browser->is_root = true; archive_file_browser_set_path( archive->browser, archive->browser->path, archive_get_tab_ext(ArchiveTabBrowser), false, - !momentum_settings.show_hidden_files); + !momentum_settings.show_hidden_files, + furi_string_get_cstr(path)); } scene_manager_next_scene(archive->scene_manager, ArchiveAppSceneBrowser); diff --git a/applications/main/archive/helpers/archive_browser.c b/applications/main/archive/helpers/archive_browser.c index d55180415..ef39ca802 100644 --- a/applications/main/archive/helpers/archive_browser.c +++ b/applications/main/archive/helpers/archive_browser.c @@ -121,7 +121,8 @@ void archive_file_browser_set_path( FuriString* path, const char* filter_ext, bool skip_assets, - bool hide_dot_files) { + bool hide_dot_files, + const char* override_home_path) { furi_assert(browser); if(!browser->worker_running) { browser->worker = @@ -137,6 +138,7 @@ void archive_file_browser_set_path( file_browser_worker_set_config( browser->worker, path, filter_ext, skip_assets, hide_dot_files); } + browser->override_home_path = override_home_path; } bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx) { @@ -385,7 +387,9 @@ bool archive_is_home(ArchiveBrowserView* browser) { return true; } - const char* default_path = archive_get_default_path(archive_get_tab(browser)); + const char* default_path = browser->override_home_path ? + browser->override_home_path : + archive_get_default_path(archive_get_tab(browser)); return furi_string_cmp_str(browser->path, default_path) == 0; } @@ -589,7 +593,12 @@ void archive_switch_tab(ArchiveBrowserView* browser, InputKey key) { tab == ArchiveTabInternal ? false : !momentum_settings.show_hidden_files; archive_file_browser_set_path( - browser, browser->path, archive_get_tab_ext(tab), skip_assets, hide_dot_files); + browser, + browser->path, + archive_get_tab_ext(tab), + skip_assets, + hide_dot_files, + NULL); tab_empty = false; // Empty check will be performed later } } diff --git a/applications/main/archive/helpers/archive_browser.h b/applications/main/archive/helpers/archive_browser.h index 2b020ed1c..2378c53b2 100644 --- a/applications/main/archive/helpers/archive_browser.h +++ b/applications/main/archive/helpers/archive_browser.h @@ -88,7 +88,8 @@ void archive_file_browser_set_path( FuriString* path, const char* filter_ext, bool skip_assets, - bool hide_dot_files); + bool hide_dot_files, + const char* override_home_path); bool archive_is_item_in_array(ArchiveBrowserViewModel* model, uint32_t idx); bool archive_is_file_list_load_required(ArchiveBrowserViewModel* model); void archive_update_offset(ArchiveBrowserView* browser); diff --git a/applications/main/archive/views/archive_browser_view.h b/applications/main/archive/views/archive_browser_view.h index c94d60631..098e2d22c 100644 --- a/applications/main/archive/views/archive_browser_view.h +++ b/applications/main/archive/views/archive_browser_view.h @@ -95,6 +95,7 @@ struct ArchiveBrowserView { bool is_root; FuriTimer* scroll_timer; File* disk_image; + const char* override_home_path; }; typedef struct {