1
0
Fork 0
forked from len0rd/rockbox

multiboot_select plugin check volume root for valid firmware -- Try 2

I'm not sure why but on my fuze v2 I don't get the '.' nd '..'
directories back from readdir

that make removing '.' to find /.rockbox inconsistent

Instead filter out files and strcmp the incoming dirs
to BOOTDIR (.rockbox) and clear it when they match

Change-Id: Id8f3312cb3ae624dff1be21f745034c08c4ae1a7
This commit is contained in:
William Wilgus 2024-04-02 21:00:13 -04:00
parent 4a91d37613
commit 8c994db247

View file

@ -155,11 +155,20 @@ static int find_roots(void)
struct dirent* ent; struct dirent* ent;
while((ent = rb->readdir(dir))) { while((ent = rb->readdir(dir))) {
/* skip non-directories */
if ((rb->dir_get_info(dir, ent).attribute & ATTR_DIRECTORY) == 0) {
continue;
}
const char *dname = ent->d_name; const char *dname = ent->d_name;
if (*dname == '.' && *(dname + 1) == '\0') /* check for bootdir in the root of the volume */
dname++; /* skip the dot so we can check root of volume */ if (rb->strcmp(bootdir, dname) == 0) {
dname = "";
}
int r = rb->snprintf(tmpbuf, sizeof(tmpbuf), "/<%d>/%s/%s/%s", int r = rb->snprintf(tmpbuf, sizeof(tmpbuf), "/<%d>/%s/%s/%s",
vol, dname, bootdir, BOOTFILE); vol, dname, bootdir, BOOTFILE);
if(r < 0 || (size_t)r >= sizeof(tmpbuf)) if(r < 0 || (size_t)r >= sizeof(tmpbuf))
continue; continue;