Skip to content

Commit

Permalink
fix showItemInFolder on macos
Browse files Browse the repository at this point in the history
fixes #1762
  • Loading branch information
mifi committed Dec 2, 2023
1 parent 2c7f166 commit 6880422
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions public/electron.js
Expand Up @@ -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)?.();
});
Expand Down
5 changes: 2 additions & 3 deletions src/dialogs/index.jsx
Expand Up @@ -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);

Expand Down Expand Up @@ -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 }) => <ul style={{ paddingLeft: '1em' }}>{children}</ul>;
Expand Down
3 changes: 3 additions & 0 deletions src/util.js
Expand Up @@ -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;
}
Expand Down

0 comments on commit 6880422

Please sign in to comment.