mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-03-13 08:28: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 LodashId from 'lodash-id'
|
||||||
import FileSync from 'lowdb/adapters/FileSync'
|
import FileSync from 'lowdb/adapters/FileSync'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import fs from 'fs-extra'
|
||||||
import { remote, app } from 'electron'
|
import { remote, app } from 'electron'
|
||||||
|
|
||||||
const APP = process.type === 'renderer' ? remote.app : app
|
const APP = process.type === 'renderer' ? remote.app : app
|
||||||
const STORE_PATH = APP.getPath('userData')
|
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 adapter = new FileSync(path.join(STORE_PATH, '/data.json'))
|
||||||
|
|
||||||
const db = Datastore(adapter)
|
const db = Datastore(adapter)
|
||||||
|
@ -23,7 +23,7 @@ const settingWinURL = process.env.NODE_ENV === 'development'
|
|||||||
: `file://${__dirname}/index.html#setting/upload`
|
: `file://${__dirname}/index.html#setting/upload`
|
||||||
|
|
||||||
function createTray () {
|
function createTray () {
|
||||||
tray = new Tray(`${__static}/menubarDefaultTemplate.png`)
|
tray = new Tray(`${__static}/menubar.png`)
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
{
|
{
|
||||||
role: 'quit',
|
role: 'quit',
|
||||||
@ -111,7 +111,7 @@ function createTray () {
|
|||||||
}
|
}
|
||||||
window.webContents.send('dragFiles', imgs)
|
window.webContents.send('dragFiles', imgs)
|
||||||
})
|
})
|
||||||
toggleWindow()
|
// toggleWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
const createWindow = () => {
|
const createWindow = () => {
|
||||||
@ -146,7 +146,7 @@ const createSettingWindow = () => {
|
|||||||
settingWindow = new BrowserWindow({
|
settingWindow = new BrowserWindow({
|
||||||
height: 450,
|
height: 450,
|
||||||
width: 800,
|
width: 800,
|
||||||
show: true,
|
show: false,
|
||||||
frame: true,
|
frame: true,
|
||||||
center: true,
|
center: true,
|
||||||
fullscreenable: false,
|
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