From 9f42197b3c2ebda121bb462896e1a6a122073c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=81=E8=AA=89=E7=A8=8B?= <2659568239@qq.com> Date: Thu, 22 Feb 2024 14:44:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nodeService.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/nodeService.js b/nodeService.js index 6d02c34..5f325e5 100644 --- a/nodeService.js +++ b/nodeService.js @@ -70,13 +70,16 @@ app.post('/createShortcut', (req, res) => { // fs.unlinkSync(shortcutLinkPath); // } - try { - fs.linkSync(shortcutURL, shortcutLinkPath); - res.status(200).send('安装成功!'); - } catch (err) { - console.error(err); - res.status(500).send('安装失败!'); - } + console.log('shortcutURL', shortcutURL); + console.log('shortcutLinkPath', shortcutLinkPath); + fs.symlink(shortcutURL, shortcutLinkPath, 'file', (err) => { + if (err) { + console.error(err); + res.status(500).send('安装失败'); + return; + } + res.send('安装成功'); + }); // // 快捷方式的配置 // const config = {