From f0bbaa6011f1a22fe42da758edca7be43bebb7da Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Tue, 20 Aug 2019 17:33:48 +0000
Subject: [PATCH] Make the load()/require() search path of last resort the CWD.
 This makes the error message if failure to find the file to load less
 confusing.

---
 src/sbbs3/js_global.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/sbbs3/js_global.c b/src/sbbs3/js_global.c
index 492bf612a0..3d1c956b94 100644
--- a/src/sbbs3/js_global.c
+++ b/src/sbbs3/js_global.c
@@ -590,6 +590,10 @@ js_load(JSContext *cx, uintN argc, jsval *arglist)
 		/* lastly, search exec dir */
 		if(path[0]==0)
 			SAFEPRINTF2(path,"%s%s",p->cfg->exec_dir,filename);
+
+		if(!fexistcase(path)) {
+			SAFECOPY(path, filename);
+		}
 	}
 	free(filename);
 
-- 
GitLab