diff --git a/public/electron.js b/public/electron.js index 16c10229..878142f7 100644 --- a/public/electron.js +++ b/public/electron.js @@ -267,6 +267,8 @@ function initApp() { await shell.trashItem(path); }); + ipcMain.handle('showItemInFolder', (e, path) => shell.showItemInFolder(path)); + ipcMain.on('apiKeyboardActionResponse', (e, { id }) => { apiKeyboardActionRequests.get(id)?.(); }); diff --git a/src/dialogs/index.jsx b/src/dialogs/index.jsx index e4ec6bdd..eef9db10 100644 --- a/src/dialogs/index.jsx +++ b/src/dialogs/index.jsx @@ -11,10 +11,9 @@ import { parseDuration, formatDuration } from '../util/duration'; import Swal, { swalToastOptions, toast } from '../swal'; import { parseYouTube } from '../edlFormats'; import CopyClipboardButton from '../components/CopyClipboardButton'; -import { isWindows } from '../util'; +import { isWindows, showItemInFolder } from '../util'; const { dialog } = window.require('@electron/remote'); -const { shell } = window.require('electron'); const ReactSwal = withReactContent(Swal); @@ -571,7 +570,7 @@ export async function openDirToast({ filePath, text, html, ...props }) { html, ...props, }); - if (value) shell.showItemInFolder(filePath); + if (value) showItemInFolder(filePath); } const UnorderedList = ({ children }) => ; diff --git a/src/util.js b/src/util.js index 5aafbd72..a07f5ad0 100644 --- a/src/util.js +++ b/src/util.js @@ -19,6 +19,9 @@ const { unlink } = fsExtra; const trashFile = async (path) => ipcRenderer.invoke('tryTrashItem', path); +export const showItemInFolder = async (path) => ipcRenderer.invoke('showItemInFolder', path); + + export function getFileDir(filePath) { return filePath ? dirname(filePath) : undefined; }