From 43408cc0cec1591eb4ab3d1a107d8f0954e80828 Mon Sep 17 00:00:00 2001 From: sunny Date: Tue, 10 Oct 2023 23:37:30 +0800 Subject: [PATCH] =?UTF-8?q?:green=5Fheart:=20=E6=9E=84=E5=BB=BA=E5=90=8E?= =?UTF-8?q?=E5=A4=84=E7=90=86=E5=A4=9A=E5=B9=B3=E5=8F=B0=E5=8C=BA=E5=88=86?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handle_pkg.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/handle_pkg.js b/handle_pkg.js index befe1c2..3bc6961 100644 --- a/handle_pkg.js +++ b/handle_pkg.js @@ -31,8 +31,13 @@ fs.readFile('./package.json', 'utf-8', (err, data) => { let macSourceFile = commonPath + fileName + ".dmg"; // 复制文件 - fs.copyFileSync(winSourceFile, targetPath + fileName + ".exe"); - fs.copyFileSync(macSourceFile, targetPath + fileName + ".dmg"); + if (fs.existsSync(winSourceFile)) { + fs.copyFileSync(winSourceFile, targetPath + fileName + ".exe"); + } + + if (fs.existsSync(macSourceFile)) { + fs.copyFileSync(macSourceFile, targetPath + fileName + ".dmg"); + } });