From ca4218b30958a304ab5ba2d714a0e3256eaaf61b Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sat, 18 Jul 2020 22:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E5=87=BB=E7=A1=AE=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E6=89=93=E5=BC=80=E5=A4=87=E4=BB=BD=E6=96=87=E4=BB=B6=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/rendererEvents/showDialog.js | 4 ++-- src/renderer/store/state.js | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/rendererEvents/showDialog.js b/src/main/rendererEvents/showDialog.js index 00ed66ea..171fcaa1 100644 --- a/src/main/rendererEvents/showDialog.js +++ b/src/main/rendererEvents/showDialog.js @@ -1,8 +1,8 @@ -const { mainOn, NAMES: { mainWindow: ipcMainWindowNames } } = require('../../common/ipc') +const { mainHandle, NAMES: { mainWindow: ipcMainWindowNames } } = require('../../common/ipc') const { dialog } = require('electron') -mainOn(ipcMainWindowNames.show_dialog, (event, { type, message, detail }) => { +mainHandle(ipcMainWindowNames.show_dialog, async(event, { type, message, detail }) => { if (!global.modules.mainWindow) throw new Error('mainWindow is undefined') dialog.showMessageBoxSync(global.modules.mainWindow, { type, diff --git a/src/renderer/store/state.js b/src/renderer/store/state.js index 44e9a8e6..23a968c5 100644 --- a/src/renderer/store/state.js +++ b/src/renderer/store/state.js @@ -6,6 +6,7 @@ import { version } from '../../../package.json' import { rendererSend, rendererInvoke, NAMES } from '../../common/ipc' import languageList from '@/lang/languages.json' import path from 'path' +import { openDirInExplorer } from '../utils' const electronStore_config = window.electronStore_config = new Store({ @@ -46,14 +47,15 @@ try { }) } catch (error) { rendererInvoke(NAMES.mainWindow.get_data_path).then(dataPath => { - rendererSend(NAMES.mainWindow.show_dialog, { + let filePath = path.join(dataPath, 'playList.json.bak') + rendererInvoke(NAMES.mainWindow.show_dialog, { type: 'error', message: window.i18n.t('store.state.load_list_file_error_title'), detail: window.i18n.t('store.state.load_list_file_error_detail', { - path: path.join(dataPath, 'playList.json.bak'), + path: filePath, detail: error.message, }), - }) + }).then(() => openDirInExplorer(filePath)) }) window.electronStore_list = new Store({ name: 'playList',