chdir in script path to allow scripts like Crossfire or BF to work correctly
This commit is contained in:
@@ -89,19 +89,16 @@ bool readToolName(const char * filename, char * name)
|
|||||||
void addRadioScriptTool(uint8_t index, const char * path)
|
void addRadioScriptTool(uint8_t index, const char * path)
|
||||||
{
|
{
|
||||||
char toolName[TOOL_NAME_MAXLEN + 1];
|
char toolName[TOOL_NAME_MAXLEN + 1];
|
||||||
const char * label;
|
|
||||||
char * ext = (char *)getFileExtension(path);
|
if (!readToolName(path, toolName)) {
|
||||||
if (readToolName(path, toolName)) {
|
strAppendFilename(toolName, getBasename(path), TOOL_NAME_MAXLEN);
|
||||||
label = toolName;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*ext = '\0';
|
|
||||||
label = getBasename(path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addRadioTool(index, label)) {
|
if (addRadioTool(index, toolName)) {
|
||||||
f_chdir("/SCRIPTS/TOOLS/");
|
char toolPath[_MAX_LFN];
|
||||||
*ext = '.';
|
strcpy(toolPath, path);
|
||||||
|
*((char *)getBasename(toolPath)-1) = '\0';
|
||||||
|
f_chdir(toolPath);
|
||||||
luaExec(path);
|
luaExec(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user