1
0
Fork 0
forked from len0rd/rockbox

Bugfixes: (all) Don't try to build the directory list when showdir() returns -1. (hotswap) Handle the 'dir no longer valid' situation in all cases, not only when the file system change happens while browsing. Force this detection when returning from wps.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6472 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-05-14 23:48:18 +00:00
parent 268f0b4337
commit eb8ceadc32

View file

@ -1117,19 +1117,10 @@ static bool dirbrowse(void)
#ifdef HAVE_HOTSWAP #ifdef HAVE_HOTSWAP
case SYS_FS_CHANGED: case SYS_FS_CHANGED:
if (!id3db) /* file browsing */ if (!id3db)
{ reload_dir = true;
if (currdir[1]) /* not in the root */ /* The 'dir no longer valid' situation will be caught later
{ * by checking the showdir() result. */
DIR *dir = opendir(currdir);
if (dir) /* path still valid */
{
closedir(dir);
break; /* don't reload the root */
}
}
reload_root = true;
}
break; break;
#endif #endif
@ -1159,6 +1150,11 @@ static bool dirbrowse(void)
lcd_stop_scroll(); lcd_stop_scroll();
if (wps_show() == SYS_USB_CONNECTED) if (wps_show() == SYS_USB_CONNECTED)
reload_root = true; reload_root = true;
#ifdef HAVE_HOTSWAP
else
if (!id3db) /* Try reload to catch 'no longer valid' case. */
reload_dir = true;
#endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
tree_max_on_screen = recalc_screen_height(); tree_max_on_screen = recalc_screen_height();
#endif #endif
@ -1167,6 +1163,9 @@ static bool dirbrowse(void)
start_wps=false; start_wps=false;
} }
#ifdef HAVE_HOTSWAP
check_rescan:
#endif
/* do we need to rescan dir? */ /* do we need to rescan dir? */
if (reload_dir || reload_root || if (reload_dir || reload_root ||
lastfilter != *tc.dirfilter || lastfilter != *tc.dirfilter ||
@ -1217,6 +1216,14 @@ static bool dirbrowse(void)
lcd_setfont(FONT_UI); lcd_setfont(FONT_UI);
#endif #endif
numentries = showdir(); numentries = showdir();
#ifdef HAVE_HOTSWAP
if (currdir[1] && (numentries < 0))
{ /* not in root and reload failed */
reload_root = true; /* try root */
reload_dir = false;
goto check_rescan;
}
#endif
update_all = true; update_all = true;
put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true); put_cursorxy(CURSOR_X, CURSOR_Y + tc.dircursor, true);
@ -1224,7 +1231,7 @@ static bool dirbrowse(void)
reload_dir = false; reload_dir = false;
} }
if ( numentries && need_update) { if ( (numentries > 0) && need_update) {
i = tc.dirstart+tc.dircursor; i = tc.dirstart+tc.dircursor;
/* if MP3 filter is on, cut off the extension */ /* if MP3 filter is on, cut off the extension */