From 1398c1b359af1789967fa3b84885ff1fc6fc55d1 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Tue, 5 Aug 2025 17:28:38 +0900 Subject: [PATCH] Intoduce UseObject(, ) in app.js Intoduce UseObject(, ) in app.js --- app.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app.js b/app.js index c28e9d9..38e8b78 100644 --- a/app.js +++ b/app.js @@ -187,6 +187,17 @@ if (typeof CreateObject === "undefined") { }; } +if (typeof UseObject === "undefined") { + var UseObject = function(progId, callback) { + var obj = CreateObject(progId); + try { + return callback(obj); + } finally { + obj = null; + } + } +} + /** * @FN {string} The name of the file. */ @@ -283,7 +294,9 @@ function require(pathname) { return filename; })({ existsSync: function(filename) { - return CreateObject("Scripting.FileSystemObject").FileExists(filename); + return UseObject("Scripting.FileSystemObject", function(fso) { + return fso.FileExists(filename); + }); } }, { join: function() {