diff options
| author | Nick Peskett <rockbox@peskett.co.uk> | 2012-03-19 09:56:38 +0000 |
|---|---|---|
| committer | Nick Peskett <rockbox@peskett.co.uk> | 2012-03-19 11:49:55 +0100 |
| commit | be10817e1c09d5a41710435cf6d58deb6dde9301 (patch) | |
| tree | 4635fcb1ab51d2ef6dc1db28db045c369cf1abaf /apps/plugins | |
| parent | 69978d7046cd7e537c5079a5e306d22621a1767a (diff) | |
| download | rockbox-be10817e1c09d5a41710435cf6d58deb6dde9301.zip rockbox-be10817e1c09d5a41710435cf6d58deb6dde9301.tar.gz rockbox-be10817e1c09d5a41710435cf6d58deb6dde9301.tar.bz2 rockbox-be10817e1c09d5a41710435cf6d58deb6dde9301.tar.xz | |
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>
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/random_folder_advance_config.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c index f459aa0..7f6018d 100644 --- a/apps/plugins/random_folder_advance_config.c +++ b/apps/plugins/random_folder_advance_config.c @@ -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) { |