1
0
Fork 0
forked from len0rd/rockbox

Option to constrain get_next_dir() to directories below global_settings.start_directory.

When enabled, if the user has set "Start File Browser Here" (config.cfg:
start directory) to anything other than root and "Auto-Change Directory"
is set to "Yes" or "Random", the directory returned when an auto change
is required will be constrained to the value of "start directory" or below.

Change-Id: Iaab773868c4cab5a54f6ae67bdb22e84642a9e4b
Reviewed-on: http://gerrit.rockbox.org/182
Reviewed-by: Nick Peskett <rockbox@peskett.co.uk>
Tested-by: Nick Peskett <rockbox@peskett.co.uk>
This commit is contained in:
Nick Peskett 2012-03-19 09:56:38 +00:00
parent 69978d7046
commit be10817e1c
10 changed files with 159 additions and 71 deletions

View file

@ -65,8 +65,15 @@ static void traversedir(char* location, char* name)
bool check = false;
int i;
rb->snprintf(fullpath, sizeof(fullpath), "%s/%s", location, name);
dir = rb->opendir(fullpath);
/* behave differently if we're at root to avoid
duplication of the initial slash later on */
if (location[0] == '\0' && name[0] == '\0') {
rb->strcpy(fullpath, "");
dir = rb->opendir("/");
} else {
rb->snprintf(fullpath, sizeof(fullpath), "%s/%s", location, name);
dir = rb->opendir(fullpath);
}
if (dir) {
entry = rb->readdir(dir);
while (entry) {