From f3852b20ca6ee8c847bba68a2d3a8e77828bced4 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Thu, 17 Nov 2022 22:40:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=A4=84=E7=90=86=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/nodejs.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/utils/nodejs.ts b/src/common/utils/nodejs.ts index d68d5c73..25bb07c3 100644 --- a/src/common/utils/nodejs.ts +++ b/src/common/utils/nodejs.ts @@ -16,6 +16,7 @@ export const dirname = (p: string): string => path.dirname(p) */ export const checkPath = async(path: string): Promise => { return await new Promise(resolve => { + if (!path) return resolve(false) fs.access(path, fs.constants.F_OK, err => { if (err) return resolve(false) resolve(true) @@ -25,6 +26,7 @@ export const checkPath = async(path: string): Promise => { export const getFileStats = async(path: string): Promise => { return await new Promise(resolve => { + if (!path) return resolve(null) fs.stat(path, (err, stats) => { if (err) return resolve(null) resolve(stats)