diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2012-08-14 17:24:00 +0200 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2012-08-15 23:10:28 +0200 |
| commit | 5d9b26f6a29e9c429f4f1f09ce0762f2d04023c7 (patch) | |
| tree | 9f89e50d28ba13bafa4bdeef7bc7f7f6a7d4f15e /apps/gui/folder_select.c | |
| parent | 54e6bafada0f0b55246e208c3ffb85394756135f (diff) | |
| download | rockbox-5d9b26f6a29e9c429f4f1f09ce0762f2d04023c7.zip rockbox-5d9b26f6a29e9c429f4f1f09ce0762f2d04023c7.tar.gz rockbox-5d9b26f6a29e9c429f4f1f09ce0762f2d04023c7.tar.bz2 rockbox-5d9b26f6a29e9c429f4f1f09ce0762f2d04023c7.tar.xz | |
folder_select: fix problem when selecting / as folder.
Change-Id: Id4880267e8478cebe073b958a58fef1ac22dd336
Diffstat (limited to 'apps/gui/folder_select.c')
| -rw-r--r-- | apps/gui/folder_select.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/gui/folder_select.c b/apps/gui/folder_select.c index 05354c4..f2830fb 100644 --- a/apps/gui/folder_select.c +++ b/apps/gui/folder_select.c @@ -103,9 +103,13 @@ static char* get_full_path(struct folder *start) { static char buffer[MAX_PATH]; - buffer[0] = '\0'; - - get_full_path_r(start, buffer); + if (strcmp(start->name, "/")) + { + buffer[0] = 0; + get_full_path_r(start, buffer); + } + else /* get_full_path_r() does the wrong thing for / */ + return "/"; return buffer; } @@ -447,8 +451,12 @@ static void save_folders_r(struct folder *root, char* dst, size_t maxlen) snprintf(buffer_front, buffer_end - buffer_front, "%s:", get_full_path(this->folder)); else + { + char *p = get_full_path(root); snprintf(buffer_front, buffer_end - buffer_front, - "%s/%s:", get_full_path(root), this->name); + "%s/%s:", strcmp(p, "/") ? p : "", + strcmp(this->name, "/") ? this->name : ""); + } strlcat(dst, buffer_front, maxlen); } else if (this->state == EXPANDED) |