Skip to content
Snippets Groups Projects
Commit 9c17fffd authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

js.exec() will now execute scripts from the configured mods and exec dirs

... if not passed a full path and the script file doesn't exist in the
startup_dir (if specified) or the same directory the calling script was
executed from (js.exec_dir).

This should fix the reported issue when trying to use the "spy" command from
a cmdshell script run from the mods dir:

!JavaScript  /sbbs/exec/str_cmds.js line 388: Error: Script file (mqtt_spy.js) does not exist
parent 3940ae18
Branches
No related tags found
No related merge requests found
Pipeline #8894 passed
......@@ -416,8 +416,18 @@ js_execfile(JSContext *cx, uintN argc, jsval *arglist)
path[0] = 0;
JS_RESUMEREQUEST(cx, rc);
}
if (*path == '\0')
SAFECOPY(path, cmd);
if (*path == '\0') {
if (gptp->cfg->mods_dir[0] != '\0') {
snprintf(path, sizeof path, "%s%s", gptp->cfg->mods_dir, cmd);
if (!fexistcase(path))
*path = '\0';
}
if (*path == '\0') {
snprintf(path, sizeof path, "%s%s", gptp->cfg->exec_dir, cmd);
if (!fexistcase(path))
SAFECOPY(path, cmd);
}
}
}
}
free(cmd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment