mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-06 13:24:06 +08:00
fix: 修正读取数据库路径时代码执行细节
This commit is contained in:
parent
a2c3a578e1
commit
3ef8a933da
@ -1,5 +1,5 @@
|
||||
{
|
||||
"database.path": "",
|
||||
"database.path": {},
|
||||
"database.maxsize": 800,
|
||||
"database.maxage": 14,
|
||||
"operation.shown": ["copy", "view", "collect", "un-collect", "remove"],
|
||||
|
@ -1,4 +1,5 @@
|
||||
import restoreSetting from './restoreSetting'
|
||||
import { defaultPath } from './restoreSetting'
|
||||
import { getNativeId } from '../utils'
|
||||
|
||||
const setting = utools.dbStorage.getItem('setting') || restoreSetting()
|
||||
@ -9,8 +10,14 @@ if (typeof setting.database.path === 'string') {
|
||||
setting.database.path = {
|
||||
[nativeId]: setting.database.path
|
||||
}
|
||||
// 将设置更新到数据库
|
||||
utools.dbStorage.setItem('setting', setting)
|
||||
} else {
|
||||
// 新版本的setting中path是对象,但是没有当前平台的路径
|
||||
if (!setting.database.path[nativeId]) {
|
||||
setting.database.path[nativeId] = defaultPath
|
||||
}
|
||||
}
|
||||
|
||||
// 将设置更新到数据库
|
||||
utools.dbStorage.setItem('setting', setting)
|
||||
|
||||
export default setting
|
||||
|
@ -15,3 +15,5 @@ export default function restoreSetting() {
|
||||
utools.dbStorage.setItem('setting', setting)
|
||||
return setting
|
||||
}
|
||||
|
||||
export { defaultPath }
|
||||
|
Loading…
x
Reference in New Issue
Block a user