fix(firmware): apps / tools list may show duplicate entries (#6703)

This commit is contained in:
philmoz
2025-10-22 10:45:24 +10:00
committed by GitHub
parent 564956894f
commit 32b7218723
2 changed files with 12 additions and 0 deletions
@@ -126,6 +126,12 @@ static void scanLuaTools(std::list<ToolEntry>& scripts)
char path[FF_MAX_LFN + 1] = SCRIPTS_TOOLS_PATH "/";
strcat(path, fno.fname);
if (inFolder) {
// check if .lua with same name exists - skip folder to avoid duplicate entries
auto plen = strlen(path);
strcat(path, ".lua");
if (f_stat(path, nullptr) == FR_OK)
continue;
path[plen] = 0;
strcat(path, "/main.lua");
if (f_stat(path, nullptr) != FR_OK)
continue;
@@ -147,6 +147,12 @@ void menuRadioTools(event_t event)
char path[FF_MAX_LFN + 1] = SCRIPTS_TOOLS_PATH "/";
strcat(path, fno.fname);
if (inFolder) {
// check if .lua with same name exists - skip folder to avoid duplicate entries
auto plen = strlen(path);
strcat(path, ".lua");
if (f_stat(path, nullptr) == FR_OK)
continue;
path[plen] = 0;
strcat(path, "/main.lua");
if (f_stat(path, nullptr) != FR_OK)
continue;