mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 00:05:17 +03:00
parent
9841b1ed2c
commit
87a1afb748
71 changed files with 1183 additions and 17 deletions
|
@ -86,20 +86,17 @@ bool readToolName(const char * filename, char * name)
|
|||
return true;
|
||||
}
|
||||
|
||||
void addRadioScriptTool(uint8_t index, const char * filename)
|
||||
void addRadioScriptTool(uint8_t index, const char * path)
|
||||
{
|
||||
TCHAR path[_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
|
||||
strcat(path, filename);
|
||||
|
||||
char toolName[TOOL_NAME_MAXLEN + 1];
|
||||
const char * label;
|
||||
if (readToolName(path, toolName)) {
|
||||
label = toolName;
|
||||
}
|
||||
else {
|
||||
char * ext = (char *)getFileExtension(filename);
|
||||
char * ext = (char *)getFileExtension(path);
|
||||
*ext = '\0';
|
||||
label = filename;
|
||||
label = getBasename(path);
|
||||
}
|
||||
|
||||
if (addRadioTool(index, label)) {
|
||||
|
@ -150,17 +147,24 @@ void menuRadioTools(event_t event)
|
|||
FILINFO fno;
|
||||
DIR dir;
|
||||
|
||||
#if defined(CROSSFIRE)
|
||||
if(isFileAvailable(SCRIPTS_TOOLS_PATH "/CROSSFIRE/crossfire.lua"))
|
||||
addRadioScriptTool(index++, SCRIPTS_TOOLS_PATH "/CROSSFIRE/crossfire.lua");
|
||||
#endif
|
||||
|
||||
FRESULT res = f_opendir(&dir, SCRIPTS_TOOLS_PATH);
|
||||
if (res == FR_OK) {
|
||||
for (;;) {
|
||||
TCHAR path[_MAX_LFN+1] = SCRIPTS_TOOLS_PATH "/";
|
||||
res = f_readdir(&dir, &fno); /* Read a directory item */
|
||||
if (res != FR_OK || fno.fname[0] == 0) break; /* Break on error or end of dir */
|
||||
if (fno.fattrib & AM_DIR) continue; /* Skip subfolders */
|
||||
if (fno.fattrib & AM_HID) continue; /* Skip hidden files */
|
||||
if (fno.fattrib & AM_SYS) continue; /* Skip system files */
|
||||
|
||||
strcat(path, fno.fname);
|
||||
if (isRadioScriptTool(fno.fname))
|
||||
addRadioScriptTool(index++, fno.fname);
|
||||
addRadioScriptTool(index++, path);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue