AP_ROMFS: don't require / in filename

This commit is contained in:
Iampete1 2024-02-20 18:41:23 +00:00 committed by Andrew Tridgell
parent 93d8de2834
commit 785e0c4c62
1 changed files with 1 additions and 2 deletions

View File

@ -117,8 +117,7 @@ const char *AP_ROMFS::dir_list(const char *dirname, uint16_t &ofs)
{ {
const size_t dlen = strlen(dirname); const size_t dlen = strlen(dirname);
for ( ; ofs < ARRAY_SIZE(files); ofs++) { for ( ; ofs < ARRAY_SIZE(files); ofs++) {
if (strncmp(dirname, files[ofs].filename, dlen) == 0 && if ((dlen == 0) || (strncmp(dirname, files[ofs].filename, dlen) == 0)) {
files[ofs].filename[dlen] == '/') {
// found one // found one
return files[ofs++].filename; return files[ofs++].filename;
} }