summaryrefslogtreecommitdiff
path: root/apps/plugins/random_folder_advance_config.c
diff options
context:
space:
mode:
authorNick Peskett <rockbox@peskett.co.uk>2012-03-19 09:56:38 +0000
committerNick Peskett <rockbox@peskett.co.uk>2012-03-19 11:49:55 +0100
commitbe10817e1c09d5a41710435cf6d58deb6dde9301 (patch)
tree4635fcb1ab51d2ef6dc1db28db045c369cf1abaf /apps/plugins/random_folder_advance_config.c
parent69978d7046cd7e537c5079a5e306d22621a1767a (diff)
downloadrockbox-be10817e1c09d5a41710435cf6d58deb6dde9301.tar.gz
rockbox-be10817e1c09d5a41710435cf6d58deb6dde9301.zip
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/random_folder_advance_config.c')
-rw-r--r--apps/plugins/random_folder_advance_config.c11
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 f459aa0776..7f6018df4e 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)
65 bool check = false; 65 bool check = false;
66 int i; 66 int i;
67 67
68 rb->snprintf(fullpath, sizeof(fullpath), "%s/%s", location, name); 68 /* behave differently if we're at root to avoid
69 dir = rb->opendir(fullpath); 69 duplication of the initial slash later on */
70 if (location[0] == '\0' && name[0] == '\0') {
71 rb->strcpy(fullpath, "");
72 dir = rb->opendir("/");
73 } else {
74 rb->snprintf(fullpath, sizeof(fullpath), "%s/%s", location, name);
75 dir = rb->opendir(fullpath);
76 }
70 if (dir) { 77 if (dir) {
71 entry = rb->readdir(dir); 78 entry = rb->readdir(dir);
72 while (entry) { 79 while (entry) {