Prefix existsSync checks with script directory

Change existsSync to resolve filenames relative to the current script directory by prepending require._getCurrentScriptDirectory() + "\\" to the provided filename before calling Scripting.FileSystemObject.FileExists. This ensures relative paths are correctly resolved when checking file existence (prevents false negatives when filenames are relative to the script).
This commit is contained in:
Namhyeon, Go 2026-04-12 19:44:04 +09:00
parent 55f6f1c438
commit 43d945055f

2
app.js
View File

@ -477,7 +477,7 @@ function require(pathname) {
})({
existsSync: function(filename) {
return UseObject("Scripting.FileSystemObject", function(fso) {
return fso.FileExists(filename);
return fso.FileExists(require._getCurrentScriptDirectory() + "\\" + filename);
});
}
}, {