mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-03-13 00:18:13 -04:00
Fixed: userData path not found error
This commit is contained in:
parent
d87501212f
commit
cfa360bb09
@ -2,11 +2,18 @@ import Datastore from 'lowdb'
|
||||
import LodashId from 'lodash-id'
|
||||
import FileSync from 'lowdb/adapters/FileSync'
|
||||
import path from 'path'
|
||||
import fs from 'fs-extra'
|
||||
import { remote, app } from 'electron'
|
||||
|
||||
const APP = process.type === 'renderer' ? remote.app : app
|
||||
const STORE_PATH = APP.getPath('userData')
|
||||
|
||||
if (process.type !== 'renderer') {
|
||||
if (!fs.pathExistsSync(STORE_PATH)) {
|
||||
fs.mkdirpSync(STORE_PATH)
|
||||
}
|
||||
}
|
||||
|
||||
const adapter = new FileSync(path.join(STORE_PATH, '/data.json'))
|
||||
|
||||
const db = Datastore(adapter)
|
||||
|
@ -23,7 +23,7 @@ const settingWinURL = process.env.NODE_ENV === 'development'
|
||||
: `file://${__dirname}/index.html#setting/upload`
|
||||
|
||||
function createTray () {
|
||||
tray = new Tray(`${__static}/menubarDefaultTemplate.png`)
|
||||
tray = new Tray(`${__static}/menubar.png`)
|
||||
const contextMenu = Menu.buildFromTemplate([
|
||||
{
|
||||
role: 'quit',
|
||||
@ -111,7 +111,7 @@ function createTray () {
|
||||
}
|
||||
window.webContents.send('dragFiles', imgs)
|
||||
})
|
||||
toggleWindow()
|
||||
// toggleWindow()
|
||||
}
|
||||
|
||||
const createWindow = () => {
|
||||
@ -146,7 +146,7 @@ const createSettingWindow = () => {
|
||||
settingWindow = new BrowserWindow({
|
||||
height: 450,
|
||||
width: 800,
|
||||
show: true,
|
||||
show: false,
|
||||
frame: true,
|
||||
center: true,
|
||||
fullscreenable: false,
|
||||
|
BIN
static/menubar.png
Normal file
BIN
static/menubar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 422 B |
Binary file not shown.
Before Width: | Height: | Size: 438 B |
Loading…
Reference in New Issue
Block a user