diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
index c90a420d4b..bb539d33a2 100644
--- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
+++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js
@@ -6,7 +6,7 @@ import { useDrag, useDrop } from 'react-dnd';
import { IconChevronRight, IconDots } from '@tabler/icons';
import { useSelector, useDispatch } from 'react-redux';
import { addTab, focusTab } from 'providers/ReduxStore/slices/tabs';
-import { moveItem, revealInFinder, sendRequest } from 'providers/ReduxStore/slices/collections/actions';
+import { moveItem, showInFolder, sendRequest } from 'providers/ReduxStore/slices/collections/actions';
import { collectionFolderClicked } from 'providers/ReduxStore/slices/collections';
import Dropdown from 'components/Dropdown';
import NewRequest from 'components/Sidebar/NewRequest';
@@ -227,9 +227,10 @@ const CollectionItem = ({ item, collection, searchText }) => {
}
};
- const handleReveal = () => {
- dispatch(revealInFinder(item.pathname)).catch((error) => {
- toast.error('Error revealing file:', error);
+ const handleShowInFolder = () => {
+ dispatch(showInFolder(item.pathname)).catch((error) => {
+ console.error('Error opening the folder', error);
+ toast.error('Error opening the folder');
});
};
@@ -384,17 +385,15 @@ const CollectionItem = ({ item, collection, searchText }) => {
Generate Code
)}
- {!isFolder && (
-
{
- dropdownTippyRef.current.hide();
- handleReveal();
- }}
- >
- Reveal in Finder
-
- )}
+ {
+ dropdownTippyRef.current.hide();
+ handleShowInFolder();
+ }}
+ >
+ Show in Folder
+
{
diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
index 169232f067..e77d377cef 100644
--- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
+++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
@@ -1194,11 +1194,9 @@ export const hydrateCollectionWithUiStateSnapshot = (payload) => (dispatch, getS
});
};
- export const revealInFinder = (collectionPath) => () => {
+ export const showInFolder = (collectionPath) => () => {
return new Promise((resolve, reject) => {
const { ipcRenderer } = window;
-
- ipcRenderer.invoke('renderer:reveal-in-finder', collectionPath).then(resolve).catch(reject);
+ ipcRenderer.invoke('renderer:show-in-folder', collectionPath).then(resolve).catch(reject);
});
};
-
\ No newline at end of file
diff --git a/packages/bruno-electron/src/ipc/collection.js b/packages/bruno-electron/src/ipc/collection.js
index da7bfb3d44..2b40a30d3f 100644
--- a/packages/bruno-electron/src/ipc/collection.js
+++ b/packages/bruno-electron/src/ipc/collection.js
@@ -3,7 +3,6 @@ const fs = require('fs');
const fsExtra = require('fs-extra');
const os = require('os');
const path = require('path');
-const { exec } = require('child_process');
const { ipcMain, shell, dialog, app } = require('electron');
const { envJsonToBru, bruToJson, jsonToBru, jsonToCollectionBru } = require('../bru');
@@ -778,40 +777,17 @@ const registerRendererEventHandlers = (mainWindow, watcher, lastOpenedCollection
}
});
- ipcMain.handle('renderer:reveal-in-finder', async (event, filePath) => {
+ ipcMain.handle('renderer:show-in-folder', async (event, filePath) => {
try {
if (!filePath) {
- throw new Error('File path is required.');
- }
-
- const resolvedPath = path.resolve(filePath);
-
- if (!fs.existsSync(resolvedPath)) {
- throw new Error('The specified file does not exist.');
- }
-
- console.log(process.platform, "process.platform")
-
- switch (process.platform) {
- case 'darwin': // macOS
- shell.showItemInFolder(resolvedPath);
- break;
- case 'win32': // Windows
- shell.showItemInFolder(resolvedPath);
- break;
- case 'linux': // Linux
- exec(`xdg-open "${resolvedPath}"`);
- break;
- default:
- throw new Error('Unsupported platform.');
- }
-
- return { success: true };
+ throw new Error('File path is required');
+ }
+ shell.showItemInFolder(filePath);
} catch (error) {
- console.error('Error in reveal-in-finder:', error);
- return { success: false, message: error.message };
+ console.error('Error in show-in-folder: ', error);
+ throw new Error(error);
}
- });
+ });
};
const registerMainEventHandlers = (mainWindow, watcher, lastOpenedCollections) => {