forked from len0rd/rockbox
Redo a hack that precluded entering a folder on an ejected hotswap drive. Use storage api and proper defines for the drive folder instead.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23755 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
10753f195b
commit
1ecb753668
2 changed files with 35 additions and 8 deletions
|
@ -37,8 +37,12 @@
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
#include "talk.h"
|
#include "talk.h"
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "hotswap.h"
|
|
||||||
|
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
#include "storage.h"
|
||||||
|
#include "hotswap.h"
|
||||||
|
#include "dir.h"
|
||||||
|
#endif
|
||||||
/* gui api */
|
/* gui api */
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "splash.h"
|
#include "splash.h"
|
||||||
|
@ -110,14 +114,37 @@ static int browser(void* param)
|
||||||
{
|
{
|
||||||
strcpy(folder, current_track_path);
|
strcpy(folder, current_track_path);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_HOTSWAP /* quick hack to stop crashing if you try entering
|
|
||||||
the browser from the menu when you were in the card
|
|
||||||
and it was removed */
|
|
||||||
else if (strchr(last_folder, '<') && (card_detect() == false))
|
|
||||||
strcpy(folder, "/");
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
bool in_hotswap = false;
|
||||||
|
/* handle entering an ejected drive */
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < NUM_VOLUMES; i++)
|
||||||
|
{
|
||||||
|
char vol_string[VOL_ENUM_POS + 8];
|
||||||
|
if (!storage_removable(i))
|
||||||
|
continue;
|
||||||
|
/* VOL_NAMES contains a %d */
|
||||||
|
snprintf(vol_string, sizeof(vol_string), "/"VOL_NAMES, i);
|
||||||
|
/* test whether we would browse the external card */
|
||||||
|
if (!storage_present(i) &&
|
||||||
|
(strstr(last_folder, vol_string)
|
||||||
|
#ifdef HAVE_HOTSWAP_STORAGE_AS_MAIN
|
||||||
|
|| (i == 0)
|
||||||
|
#endif
|
||||||
|
))
|
||||||
|
{ /* leave folder as "/" to avoid crash when trying
|
||||||
|
* to access an ejected drive */
|
||||||
|
strcpy(folder, "/");
|
||||||
|
in_hotswap = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!in_hotswap)
|
||||||
|
#endif
|
||||||
strcpy(folder, last_folder);
|
strcpy(folder, last_folder);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_TAGCACHE
|
#ifdef HAVE_TAGCACHE
|
||||||
case GO_TO_DBBROWSER:
|
case GO_TO_DBBROWSER:
|
||||||
|
|
|
@ -555,7 +555,7 @@ stackmunge:
|
||||||
ldr sp, =stackend
|
ldr sp, =stackend
|
||||||
|
|
||||||
/* Start the main function */
|
/* Start the main function */
|
||||||
adr lr, vectors
|
ldr lr, =vectors
|
||||||
ldr pc, =main
|
ldr pc, =main
|
||||||
|
|
||||||
/* Should never get here, but let's restart in case (also needed for
|
/* Should never get here, but let's restart in case (also needed for
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue