新增当列表文件损坏时对损坏文件的备份
This commit is contained in:
@@ -30,5 +30,8 @@
|
||||
"source_alias_xm": "XM Music",
|
||||
"source_alias_bd": "BD Music",
|
||||
|
||||
"source_alias_all": "Aggregated"
|
||||
"source_alias_all": "Aggregated",
|
||||
|
||||
"load_list_file_error_title": "Error loading playlist data",
|
||||
"load_list_file_error_detail": "We have helped you back up the old list file to {path}\nIt is stored in JSON format, you can try to repair and restore it manually\n\nError details: {detail}"
|
||||
}
|
||||
|
||||
@@ -31,5 +31,8 @@
|
||||
"source_alias_xm": "小霞音乐",
|
||||
"source_alias_bd": "小杜音乐",
|
||||
|
||||
"source_alias_all": "聚合大会"
|
||||
"source_alias_all": "聚合大会",
|
||||
|
||||
"load_list_file_error_title": "播放列表数据加载错误",
|
||||
"load_list_file_error_detail": "我们已经帮你把旧的列表文件备份到{path}\n它以 JSON 格式存储,你可以尝试手动修复并恢复它\n\n错误详情:{detail}"
|
||||
}
|
||||
|
||||
@@ -27,5 +27,8 @@
|
||||
"source_alias_mg": "小蜜音樂",
|
||||
"source_alias_bd": "小杜音樂",
|
||||
"source_alias_xm": "小霞音樂",
|
||||
"source_alias_all": "聚合大會"
|
||||
"source_alias_all": "聚合大會",
|
||||
|
||||
"load_list_file_error_title": "播放列表數據加載錯誤",
|
||||
"load_list_file_error_detail": "我們已經幫你把舊的列表文件備份到{path}\n它以 JSON 格式存儲,你可以嘗試手動修復並恢復它\n\n錯誤詳情:{detail}"
|
||||
}
|
||||
|
||||
@@ -3,12 +3,11 @@
|
||||
import Store from 'electron-store'
|
||||
import { windowSizeList } from '../../common/config'
|
||||
import { version } from '../../../package.json'
|
||||
import { rendererSend, NAMES } from '../../common/ipc'
|
||||
import { rendererSend, rendererInvoke, NAMES } from '../../common/ipc'
|
||||
import languageList from '@/lang/languages.json'
|
||||
import path from 'path'
|
||||
|
||||
|
||||
window.electronStore_list = new Store({
|
||||
name: 'playList',
|
||||
})
|
||||
const electronStore_config = window.electronStore_config = new Store({
|
||||
name: 'config',
|
||||
})
|
||||
@@ -40,6 +39,27 @@ if (!window.i18n.availableLocales.includes(setting.langId)) {
|
||||
|
||||
window.i18n.locale = setting.langId
|
||||
|
||||
try {
|
||||
window.electronStore_list = new Store({
|
||||
name: 'playList',
|
||||
clearInvalidConfig: false,
|
||||
})
|
||||
} catch (error) {
|
||||
rendererInvoke(NAMES.mainWindow.get_data_path).then(dataPath => {
|
||||
rendererSend(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'),
|
||||
detail: error.message,
|
||||
}),
|
||||
})
|
||||
})
|
||||
window.electronStore_list = new Store({
|
||||
name: 'playList',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
themes: [
|
||||
|
||||
Reference in New Issue
Block a user