ref: bugfix windows rm 命令无法执行

This commit is contained in:
muwoo 2021-09-13 17:24:51 +08:00
parent 9242f17cde
commit 87e7501c0a
2 changed files with 3 additions and 2 deletions

View File

@ -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",

View File

@ -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 });