umbrella22

更换已废弃的方法

1 import { app, ipcMain, BrowserWindow, dialog } from 'electron' 1 import { app, ipcMain, BrowserWindow, dialog } from 'electron'
2 import { join } from 'path' 2 import { join } from 'path'
3 import { arch, platform } from 'os' 3 import { arch, platform } from 'os'
4 -import { exists, remove } from 'fs-extra' 4 +import { stat, remove } from 'fs-extra'
5 import { version } from '../../../package.json' 5 import { version } from '../../../package.json'
6 6
7 7
...@@ -33,9 +33,9 @@ class Main { ...@@ -33,9 +33,9 @@ class Main {
33 start() { 33 start() {
34 ipcMain.on('satrt-download', (event, msg) => { 34 ipcMain.on('satrt-download', (event, msg) => {
35 // 更新时检查有无同名文件,若有就删除,若无就开始下载 35 // 更新时检查有无同名文件,若有就删除,若无就开始下载
36 - exists(this.HistoryFilePath, async (e) => { 36 + stat(this.HistoryFilePath, async (err, stats) => {
37 try { 37 try {
38 - if (e) { 38 + if (stats) {
39 await remove(this.HistoryFilePath) 39 await remove(this.HistoryFilePath)
40 } 40 }
41 this.mainWindow.webContents.downloadURL(this.downloadUrl) 41 this.mainWindow.webContents.downloadURL(this.downloadUrl)
......