fix: v1.0.2 修复Mac下无法写入数据的bug

This commit is contained in:
ZiuChen 2022-08-15 21:03:46 +08:00
parent 7653ee0b48
commit 4c237064d8
3 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "clipboard-manager", "name": "clipboard-manager",
"version": "1.0.1", "version": "1.0.2",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",

View File

@ -1,5 +1,5 @@
{ {
"version": "1.0.1", "version": "1.0.2",
"pluginName": "剪贴板", "pluginName": "剪贴板",
"description": "强大的剪贴板管理工具", "description": "强大的剪贴板管理工具",
"author": "ZiuChen", "author": "ZiuChen",

View File

@ -1,7 +1,7 @@
// /* // /*
// name: clipboard_manager // name: clipboard_manager
// author: Github @ZiuChen // author: Github @ZiuChen
// lastUpdate: v1.0.1 2022/08/15 // lastUpdate: v1.0.2 2022/08/15
// desc: 监听剪贴板 读写本地文件 // desc: 监听剪贴板 读写本地文件
// */ // */
@ -10,7 +10,8 @@ const crypto = require('crypto')
const { clipboard } = require('electron') const { clipboard } = require('electron')
const nativeImage = require('electron').nativeImage const nativeImage = require('electron').nativeImage
const home = utools.getPath('home') const homePath = utools.getPath('home')
const userDataPath = utools.getPath('userData')
const dbName = '_utools_clipboard_manager_storage' const dbName = '_utools_clipboard_manager_storage'
class DB { class DB {
@ -172,7 +173,8 @@ const paste = () => {
} }
} }
const path = `${home}\\${dbName}` const isMacOs = utools.isMacOs()
const path = `${isMacOs ? userDataPath : homePath}\\${dbName}`
const db = new DB(path) const db = new DB(path)
db.init() db.init()