点击确定时打开备份文件位置

pull/277/head
lyswhut 2020-07-18 22:48:35 +08:00
parent 65df71239a
commit ca4218b309
2 changed files with 7 additions and 5 deletions

View File

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

View File

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