Skip to content

Commit

Permalink
fix: make "Reveal in Finder" work
Browse files Browse the repository at this point in the history
Same fix we applied here due to showItemInFolder flakiness in Electron
under macOS:

https://github.com/getflywheel/flywheel-local/pull/1888/files

Just needed to get the parent folder path so we don't open the
image itself.
  • Loading branch information
nickcernis authored and bgturner committed Apr 4, 2024
1 parent 7c73a7f commit 4b04fb7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/renderer/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { selectors, actions, store } from './store/store';
import invokeModal from './invokeModal';
import ConfirmRestoreBackupModalContents from './confirmRestoreBackupModalContents';
import { reportAnalytics, ANALYTIC_EVENT_TYPES } from './analytics';
import path from 'path';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const remote = require(`@electron/remote`);
Expand All @@ -21,15 +22,15 @@ export const uncompressedImageListContextMenu = 'uncompressed-image-list-context
export const comprepssedImageListNoContextMenu = 'compressed-image-list-no-context-menu';
export const compressedImageListContextMenu = 'compressed-image-list-context-menu';

const revealPathMenuItem = (path: string) => new MenuItem({
const revealPathMenuItem = (imagePath: string) => new MenuItem({
label: isMac ? 'Reveal in Finder' : 'Show folder',
click () {
shell.showItemInFolder(path);
shell.openPath(path.dirname(imagePath));

/**
* Generally, these calls should live in redux reducers, but given that we do not have
* reducers for these, this location makes the most sense
*/
* Generally, these calls should live in redux reducers, but given that we do not have
* reducers for these, this location makes the most sense
*/
reportAnalytics(ANALYTIC_EVENT_TYPES.CONTEXTMENU_REVEAL_IN_FINDER);
},
});
Expand Down

0 comments on commit 4b04fb7

Please sign in to comment.