mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-06 07:56:56 +08:00
First beta version
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import Datastore from 'lowdb'
|
||||
import FileSync from 'lowdb/adapters/FileSync'
|
||||
import path from 'path'
|
||||
import { remote, app } from 'electron'
|
||||
|
||||
const APP = process.type === 'renderer' ? remote.app : app
|
||||
const STORE_PATH = APP.getPath('userData')
|
||||
|
||||
const adapter = new FileSync(path.join(STORE_PATH, '/data.json'))
|
||||
|
||||
const db = Datastore(adapter)
|
||||
|
||||
if (!db.has('uploaded').value()) {
|
||||
db.set('uploaded', []).write()
|
||||
}
|
||||
|
||||
if (!db.has('picBed').value()) {
|
||||
db.set('picBed', {
|
||||
current: 'weibo'
|
||||
}).write()
|
||||
}
|
||||
|
||||
export default db
|
||||
Reference in New Issue
Block a user