mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
[Bugfix] set_current_file_ex filebrowser wrong file on resume
can't have it both ways blocking directories from filename makes shortcut folders browse into the folder but blocks the folder when the file browser loads it causing you to be in the wrong folder upon resume I wanted a way for the user to be able to leave the slash off so ensure shortcut folders have a trailing slash (on load) Change-Id: I9ea173a90a8c12291a159e7d30ee1076e0ca5d3e
This commit is contained in:
parent
ac03680df3
commit
5471f58fb1
2 changed files with 14 additions and 3 deletions
|
@ -369,11 +369,24 @@ static int readline_cb(int n, char *buf, void *parameters)
|
||||||
*param = NULL;
|
*param = NULL;
|
||||||
break;
|
break;
|
||||||
case SHORTCUT_BROWSER:
|
case SHORTCUT_BROWSER:
|
||||||
|
{
|
||||||
|
char *p = strmemccpy(sc->u.path, value, MAX_PATH);
|
||||||
|
if (p && dir_exists(value))
|
||||||
|
{
|
||||||
|
/* ensure ending slash */
|
||||||
|
*p = '\0';
|
||||||
|
if (*(p-2) != '/')
|
||||||
|
*(p-1) = '/';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SHORTCUT_FILE:
|
case SHORTCUT_FILE:
|
||||||
case SHORTCUT_DEBUGITEM:
|
case SHORTCUT_DEBUGITEM:
|
||||||
case SHORTCUT_PLAYLISTMENU:
|
case SHORTCUT_PLAYLISTMENU:
|
||||||
|
{
|
||||||
strmemccpy(sc->u.path, value, MAX_PATH);
|
strmemccpy(sc->u.path, value, MAX_PATH);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SHORTCUT_SETTING_APPLY:
|
case SHORTCUT_SETTING_APPLY:
|
||||||
case SHORTCUT_SETTING:
|
case SHORTCUT_SETTING:
|
||||||
/* can handle 'name: value' pair for either type */
|
/* can handle 'name: value' pair for either type */
|
||||||
|
|
|
@ -634,7 +634,7 @@ static void set_current_file_ex(const char *path, const char *filename)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!filename && !dir_exists(path)) /* path and filename supplied combined */
|
if (!filename) /* path and filename supplied combined */
|
||||||
{
|
{
|
||||||
/* separate directory from filename */
|
/* separate directory from filename */
|
||||||
/* gets the directory's name and put it into tc.currdir */
|
/* gets the directory's name and put it into tc.currdir */
|
||||||
|
@ -653,8 +653,6 @@ static void set_current_file_ex(const char *path, const char *filename)
|
||||||
}
|
}
|
||||||
else /* path and filename came in separate ensure an ending '/' */
|
else /* path and filename came in separate ensure an ending '/' */
|
||||||
{
|
{
|
||||||
if (!filename)
|
|
||||||
filename = "";
|
|
||||||
char *end_p = strmemccpy(tc.currdir, path, MAX_PATH);
|
char *end_p = strmemccpy(tc.currdir, path, MAX_PATH);
|
||||||
size_t endpos = end_p - tc.currdir;
|
size_t endpos = end_p - tc.currdir;
|
||||||
if (endpos < MAX_PATH)
|
if (endpos < MAX_PATH)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue