From 9c17fffd088ca6e57825c94bced3ede2a4fbe70d Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Windows 11)" <rob@synchro.net> Date: Thu, 24 Apr 2025 12:36:06 -0700 Subject: [PATCH] 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 --- src/sbbs3/js_internal.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/sbbs3/js_internal.c b/src/sbbs3/js_internal.c index fd842f0431..934cb9d92d 100644 --- a/src/sbbs3/js_internal.c +++ b/src/sbbs3/js_internal.c @@ -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); -- GitLab