diff --git a/public/i18n/en.yml b/public/i18n/en.yml index eaaf774..a4b2e3a 100644 --- a/public/i18n/en.yml +++ b/public/i18n/en.yml @@ -195,6 +195,8 @@ SETTINGS_CURRENT_VERSION: Current Version SETTINGS_NEWEST_VERSION: Newest Version SETTINGS_GETING: Getting... SETTINGS_TIPS_HAS_NEW_VERSION: PicList has a new version, please click confirm to open download page +SETTINGS_LOG_FILE_PATH: Log File Path +SETTINGS_CONFIG_FILE_PATH: Config File Path SETTINGS_LOG_FILE: Log File SETTINGS_GUI_LOG_FILE: GUI Log File SETTINGS_MANAGE_LOG_FILE: Manage Log File diff --git a/public/i18n/zh-CN.yml b/public/i18n/zh-CN.yml index 7cb81eb..146f784 100644 --- a/public/i18n/zh-CN.yml +++ b/public/i18n/zh-CN.yml @@ -197,6 +197,8 @@ SETTINGS_CURRENT_VERSION: 当前版本 SETTINGS_NEWEST_VERSION: 最新版本 SETTINGS_GETING: 正在获取中 SETTINGS_TIPS_HAS_NEW_VERSION: PicList更新啦,请点击确定打开下载页面 +SETTINGS_LOG_FILE_PATH: 日志文件路径 +SETTINGS_CONFIG_FILE_PATH: 配置文件路径 SETTINGS_LOG_FILE: 常规日志文件 SETTINGS_GUI_LOG_FILE: GUI日志文件 SETTINGS_MANAGE_LOG_FILE: 管理日志文件 diff --git a/public/i18n/zh-TW.yml b/public/i18n/zh-TW.yml index 48c8efd..d935847 100644 --- a/public/i18n/zh-TW.yml +++ b/public/i18n/zh-TW.yml @@ -195,6 +195,8 @@ SETTINGS_CURRENT_VERSION: 當前版本 SETTINGS_NEWEST_VERSION: 最新版本 SETTINGS_GETING: 正在取得中 SETTINGS_TIPS_HAS_NEW_VERSION: PicList更新啦,請點擊確定開啟下載頁面 +SETTINGS_LOG_FILE_PATH: 記錄檔案路徑 +SETTINGS_CONFIG_FILE_PATH: 設定檔案路徑 SETTINGS_LOG_FILE: 記錄檔案 SETTINGS_GUI_LOG_FILE: GUI記錄檔案 SETTINGS_MANAGE_LOG_FILE: 管理記錄檔案 diff --git a/src/main/events/picgoCoreIPC.ts b/src/main/events/picgoCoreIPC.ts index 1afb886..d3e894e 100644 --- a/src/main/events/picgoCoreIPC.ts +++ b/src/main/events/picgoCoreIPC.ts @@ -40,6 +40,7 @@ import { PICGO_GET_BY_ID_DB, PICGO_REMOVE_BY_ID_DB, PICGO_OPEN_FILE, + PICGO_OPEN_DIRECTORY, PASTE_TEXT, OPEN_WINDOW, GET_LANGUAGE_LIST, @@ -379,6 +380,18 @@ const handleOpenFile = () => { }) } +const handleOpenDirectory = () => { + ipcMain.on(PICGO_OPEN_DIRECTORY, (event: IpcMainEvent, dirPath?: string, inStorePath: boolean = true) => { + if (inStorePath) { + dirPath = path.join(STORE_PATH, dirPath || '') + } + if (!dirPath || !fs.existsSync(dirPath)) { + return + } + shell.openPath(dirPath) + }) +} + const handleOpenWindow = () => { ipcMain.on(OPEN_WINDOW, (event: IpcMainEvent, windowName: IWindowList) => { const window = windowManager.get(windowName) @@ -431,6 +444,7 @@ export default { handleImportLocalPlugin() handleUpdateAllPlugin() handleOpenFile() + handleOpenDirectory() handleOpenWindow() handleI18n() handleRPCActions() diff --git a/src/renderer/pages/PicGoSetting.vue b/src/renderer/pages/PicGoSetting.vue index 0103123..ccabc9b 100644 --- a/src/renderer/pages/PicGoSetting.vue +++ b/src/renderer/pages/PicGoSetting.vue @@ -283,6 +283,18 @@ {{ $T('SETTINGS_CLICK_TO_OPEN') }} + + + {{ $T('SETTINGS_CLICK_TO_OPEN') }} + + @@ -582,6 +594,18 @@ label-width="50%" size="small" > + + + {{ $T('SETTINGS_CLICK_TO_OPEN') }} + + @@ -1603,7 +1627,7 @@ import { Reading, Close, Edit, InfoFilled } from '@element-plus/icons-vue' import pkg from 'root/package.json' // 事件常量 -import { PICGO_OPEN_FILE, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants' +import { PICGO_OPEN_FILE, PICGO_OPEN_DIRECTORY, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants' import { IRPCActionType } from '~/universal/types/enum' // Electron 相关 @@ -2046,6 +2070,10 @@ function openFile (file: string) { sendToMain(PICGO_OPEN_FILE, file) } +function openDirectory (directory?: string, inStorePath = true) { + sendToMain(PICGO_OPEN_DIRECTORY, directory, inStorePath) +} + function openLogSetting () { logFileVisible.value = true } diff --git a/src/universal/events/constants.ts b/src/universal/events/constants.ts index ddfe7dc..9132b06 100644 --- a/src/universal/events/constants.ts +++ b/src/universal/events/constants.ts @@ -13,6 +13,7 @@ export const PICGO_UPDATE_BY_ID_DB = 'PICGO_UPDATE_BY_ID_DB' export const PICGO_GET_BY_ID_DB = 'PICGO_GET_BY_ID_DB' export const PICGO_REMOVE_BY_ID_DB = 'PICGO_REMOVE_BY_ID_DB' export const PICGO_OPEN_FILE = 'PICGO_OPEN_FILE' +export const PICGO_OPEN_DIRECTORY = 'PICGO_OPEN_DIRECTORY' export const OPEN_DEVTOOLS = 'OPEN_DEVTOOLS' export const SHOW_MINI_PAGE_MENU = 'SHOW_MINI_PAGE_MENU' export const SHOW_MAIN_PAGE_MENU = 'SHOW_MAIN_PAGE_MENU' diff --git a/src/universal/types/i18n.d.ts b/src/universal/types/i18n.d.ts index f3c494d..9fddb61 100644 --- a/src/universal/types/i18n.d.ts +++ b/src/universal/types/i18n.d.ts @@ -190,6 +190,8 @@ interface ILocales { SETTINGS_NEWEST_VERSION: string SETTINGS_GETING: string SETTINGS_TIPS_HAS_NEW_VERSION: string + SETTINGS_LOG_FILE_PATH: string + SETTINGS_CONFIG_FILE_PATH: string SETTINGS_LOG_FILE: string SETTINGS_GUI_LOG_FILE: string SETTINGS_MANAGE_LOG_FILE: string