1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-21 15:25:17 +03:00

chdir in script path to allow scripts like Crossfire or BF to work correctly

This commit is contained in:
3djc 2019-08-15 09:51:40 +02:00
parent 25bf2957ec
commit 4228640bce

View file

@ -89,19 +89,16 @@ bool readToolName(const char * filename, char * name)
void addRadioScriptTool(uint8_t index, const char * path)
{
char toolName[TOOL_NAME_MAXLEN + 1];
const char * label;
char * ext = (char *)getFileExtension(path);
if (readToolName(path, toolName)) {
label = toolName;
}
else {
*ext = '\0';
label = getBasename(path);
if (!readToolName(path, toolName)) {
strAppendFilename(toolName, getBasename(path), TOOL_NAME_MAXLEN);
}
if (addRadioTool(index, label)) {
f_chdir("/SCRIPTS/TOOLS/");
*ext = '.';
if (addRadioTool(index, toolName)) {
char toolPath[_MAX_LFN];
strcpy(toolPath, path);
*((char *)getBasename(toolPath)-1) = '\0';
f_chdir(toolPath);
luaExec(path);
}
}