forked from len0rd/rockbox
folder_select: fix problem when selecting / as folder.
Change-Id: Id4880267e8478cebe073b958a58fef1ac22dd336
This commit is contained in:
parent
54e6bafada
commit
5d9b26f6a2
1 changed files with 12 additions and 4 deletions
|
|
@ -103,9 +103,13 @@ static char* get_full_path(struct folder *start)
|
||||||
{
|
{
|
||||||
static char buffer[MAX_PATH];
|
static char buffer[MAX_PATH];
|
||||||
|
|
||||||
buffer[0] = '\0';
|
if (strcmp(start->name, "/"))
|
||||||
|
{
|
||||||
get_full_path_r(start, buffer);
|
buffer[0] = 0;
|
||||||
|
get_full_path_r(start, buffer);
|
||||||
|
}
|
||||||
|
else /* get_full_path_r() does the wrong thing for / */
|
||||||
|
return "/";
|
||||||
|
|
||||||
return buffer;
|
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,
|
snprintf(buffer_front, buffer_end - buffer_front,
|
||||||
"%s:", get_full_path(this->folder));
|
"%s:", get_full_path(this->folder));
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
char *p = get_full_path(root);
|
||||||
snprintf(buffer_front, buffer_end - buffer_front,
|
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);
|
strlcat(dst, buffer_front, maxlen);
|
||||||
}
|
}
|
||||||
else if (this->state == EXPANDED)
|
else if (this->state == EXPANDED)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue