From a6edd9aebee94b3a21079df44ecb9b30da776bab Mon Sep 17 00:00:00 2001 From: nonameShijian <2954700422@qq.com> Date: Mon, 1 Apr 2024 19:50:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- noname/init/node.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/noname/init/node.js b/noname/init/node.js index e1c96a719..f4be1c7d0 100644 --- a/noname/init/node.js +++ b/noname/init/node.js @@ -168,17 +168,18 @@ export function nodeReady() { }); }; game.createDir = (directory, successCallback, errorCallback) => { + const target = lib.node.path.join(__dirname, directory); if (lib.node.fs.existsSync(target)) { if (typeof errorCallback == 'function') { errorCallback(new Error(`${target}已存在`)) } } else if (checkVersion(process.versions.node, '10.12.0') > -1) { - lib.node.fs.mkdir(lib.node.path.join(__dirname, directory), { recursive: true }, e => { + lib.node.fs.mkdir(target, { recursive: true }, e => { if (e) { if (typeof errorCallback == 'function') errorCallback(e); else throw e; } else { - if (typeof successCallback == 'function') successCallback(e) + if (typeof successCallback == 'function') successCallback(); } }); } else { @@ -203,7 +204,7 @@ export function nodeReady() { } }; game.removeDir = (directory, successCallback, errorCallback) => { - const target = `${__dirname}/${directory}`; + const target = lib.node.path.join(__dirname, directory); if (!lib.node.fs.existsSync(target)) { if (typeof errorCallback == 'function') { errorCallback(new Error(`${target}不存在`)) @@ -218,7 +219,7 @@ export function nodeReady() { if (typeof errorCallback == 'function') errorCallback(e); else throw e; } else { - if (typeof successCallback == 'function') successCallback() + if (typeof successCallback == 'function') successCallback(); } }); } else {