diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 7c7064bc0..077f655b8 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -30,6 +30,7 @@ "toggleSmartPlaylistEditor": "toggle $t(entity.smartPlaylist) editor", "viewPlaylists": "view $t(entity.playlist_other)", "viewMore": "view more", + "openApplicationDirectory": "open application directory", "openIn": { "lastfm": "Open in Last.fm", "musicbrainz": "Open in MusicBrainz" diff --git a/src/main/features/core/settings/index.ts b/src/main/features/core/settings/index.ts index 0369d62ef..2a3f9e452 100644 --- a/src/main/features/core/settings/index.ts +++ b/src/main/features/core/settings/index.ts @@ -11,6 +11,9 @@ export const store = new Store({ '>=0.21.2': (store) => { store.set('window_bar_style', 'linux'); }, + '>=1.0.0': (store) => { + store.clear(); + }, }, }); diff --git a/src/main/index.ts b/src/main/index.ts index 1c9640a3d..8c5240906 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -693,3 +693,11 @@ if (!ipcMain.eventNames().includes('open-item')) { }); }); } + +// Register 'open-application-directory' handler globally, ensuring it is only registered once +if (!ipcMain.eventNames().includes('open-application-directory')) { + ipcMain.handle('open-application-directory', async () => { + const userDataPath = app.getPath('userData'); + shell.openPath(userDataPath); + }); +} diff --git a/src/preload/utils.ts b/src/preload/utils.ts index 17323ee4b..e8f0315a6 100644 --- a/src/preload/utils.ts +++ b/src/preload/utils.ts @@ -6,6 +6,10 @@ const openItem = async (path: string) => { return ipcRenderer.invoke('open-item', path); }; +const openApplicationDirectory = async () => { + return ipcRenderer.invoke('open-application-directory'); +}; + const playerErrorListener = (cb: (event: IpcRendererEvent, data: { code: number }) => void) => { ipcRenderer.on('player-error-listener', cb); }; @@ -42,6 +46,7 @@ export const utils = { isWindows, logger, mainMessageListener, + openApplicationDirectory, openItem, playerErrorListener, }; diff --git a/src/renderer/features/settings/components/window/cache-settngs.tsx b/src/renderer/features/settings/components/window/cache-settngs.tsx index a9ff97470..70cf677cb 100644 --- a/src/renderer/features/settings/components/window/cache-settngs.tsx +++ b/src/renderer/features/settings/components/window/cache-settngs.tsx @@ -94,10 +94,25 @@ export const CacheSettings = () => { }, ]; + const handleOpenApplicationDirectory = async () => { + if (isElectron() && window.api?.utils) { + await window.api.utils.openApplicationDirectory(); + } + }; + return ( - + <> + + {isElectron() && ( + + )} + ); };