shortcuts: fix 'File' shortcuts may fail when dir filter set

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Thu, 4 Jun 2026 15:35:19 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit 0836ebbd45d390d9657a6f4a0bed0542a88b2fd2
Author: Christian Soffke <[email protected]>
Date:   Thu Jun 4 21:27:15 2026 +0200

    shortcuts: fix 'File' shortcuts may fail when dir filter set
    
    Only apply dir filter to 'Browse' shortcuts, so that,
    when trying to run a file from Shortcuts that is hidden
    due to current dir filter settings, you don't get a 'Failed
    reading Unknown' message (LANG_READ_FAILED/LANG_UNKNOWN)
    because the tree entry can't be found in ft_enter.
    
    Change-Id: I4eaad2ec415c9bac352a409922848e4407dac993

diff --git a/apps/shortcuts.c b/apps/shortcuts.c
index fece4c5030..a2acc7ab65 100644
--- a/apps/shortcuts.c
+++ b/apps/shortcuts.c
@@ -765,17 +765,12 @@ int do_shortcut_menu(void *ignored)
             {
                 case SHORTCUT_PLAYLISTMENU:
                     if (!file_exists(sc->u.path))
-                    {
                         splash(HZ, ID2P(LANG_NO_FILES));
-                        break;
-                    }
                     else
-                    {
                         onplay_show_playlist_menu(sc->u.path,
                                                   dir_exists(sc->u.path) ? ATTR_DIRECTORY :
                                                   filetype_get_attr(sc->u.path),
                                                   NULL);
-                    }
                     break;
                 case SHORTCUT_FILE:
                     if (!file_exists(sc->u.path))
@@ -785,38 +780,33 @@ int do_shortcut_menu(void *ignored)
                     }
                     /* else fall through */
                 case SHORTCUT_BROWSER:
-                {
-                    if(open_plugin_add_path(ID2P(LANG_SHORTCUTS), sc->u.path, NULL) != 0)
+                    if (open_plugin_add_path(ID2P(LANG_SHORTCUTS),
+                                             sc->u.path, NULL) != 0)
                     {
                         done = GO_TO_PLUGIN;
                         break;
                     }
                     struct browse_context browse = {
-                        .dirfilter = global_settings.dirfilter,
+                        .dirfilter = SHOW_ALL, /* ignored for SHORTCUT_BROWSER */
                         .icon = Icon_NOICON,
                         .root = sc->u.path,
                     };
                     if (sc->type == SHORTCUT_FILE)
-                        browse.flags |= BROWSE_RUNFILE;
+                        browse.flags = BROWSE_RUNFILE | BROWSE_DIRFILTER;
                     done = rockbox_browse(&browse);
-
-                }
-                break;
-                case SHORTCUT_SETTING_APPLY:
-                {
+                    break;
+                case SHORTCUT_SETTING_APPLY:;
                     bool theme_changed;
                     string_to_cfg(sc->setting->cfg_name, sc->u.path, &theme_changed);
                     settings_save();
                     apply_new_setting(sc->setting);
                     break;
-                }
                 case SHORTCUT_SETTING:
-                {
-                    do_setting_screen(sc->setting,
-                        sc->name[0] ? sc->name : P2STR(ID2P(sc->setting->lang_id)),NULL);
+                    do_setting_screen(sc->setting, sc->name[0] ?
+                                      sc->name : P2STR(ID2P(sc->setting->lang_id)),
+                                      NULL);
                     apply_new_setting(sc->setting);
                     break;
-                }
                 case SHORTCUT_DEBUGITEM:
                     run_debug_screen(sc->u.path);
                     break;
@@ -838,7 +828,7 @@ int do_shortcut_menu(void *ignored)
                     break;
                 case SHORTCUT_TIME:
 #if CONFIG_RTC
-                  if (!sc->u.timedata.talktime)
+                    if (!sc->u.timedata.talktime)
 #endif
                     {
                         char timer_buf[10];
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs