From 87e7501c0a5884a27d669e02bb1025362d0101f1 Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Mon, 13 Sep 2021 17:24:51 +0800 Subject: [PATCH] =?UTF-8?q?ref:=20bugfix=20windows=20rm=20=E5=91=BD?= =?UTF-8?q?=E4=BB=A4=E6=97=A0=E6=B3=95=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/renderer/assets/common/utils.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1936750..47ed4e0 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,7 @@ "request-promise": "^4.2.6", "robotjs": "git+https://github.com/Toinane/robotjs.git", "semver": "^7.3.5", + "shelljs": "^0.8.4", "sudo-prompt": "^9.2.1", "systeminformation": "^5.8.0", "unzip": "^0.1.11", diff --git a/src/renderer/assets/common/utils.js b/src/renderer/assets/common/utils.js index 3c10bf6..cabf5fe 100644 --- a/src/renderer/assets/common/utils.js +++ b/src/renderer/assets/common/utils.js @@ -1,11 +1,11 @@ import { WINDOW_MAX_HEIGHT, WINDOW_MIN_HEIGHT, PRE_ITEM_HEIGHT, SYSTEM_PLUGINS } from './constans'; import path from 'path'; import fs from 'fs'; -import child_process from 'child_process'; import Store from 'electron-store'; import downloadFile from 'download'; import { ipcRenderer } from 'electron'; import { getlocalDataFile } from '../../../main/common/utils'; +import shell from 'shelljs'; const getApp = process.platform === 'win32' ? require('./win-app').getApp : require('./darwin-app').getApp; @@ -50,7 +50,7 @@ async function downloadZip(downloadRepoUrl, name) { const temp_dest = `${plugin_path}/${name}`; // 下载模板 if (await existOrNot(temp_dest)) { - await child_process.execSync(`rm -rf ${temp_dest}`); + shell.rm('-rf', temp_dest); } await downloadFile(downloadRepoUrl, plugin_path, { extract: true });