-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added a menu-item to show Folder and Requests in native file-browser #3787
base: main
Are you sure you want to change the base?
Conversation
* feat: Reveal in Finder * added support for linux
77059db
to
f3b2a59
Compare
shell.showItemInFolder(resolvedPath); | ||
break; | ||
case 'linux': // Linux | ||
exec(`xdg-open "${resolvedPath}"`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Electron internally seems to be using xdg-open
anyways for opening files in Linux. I don't think these platform-specific switch-cases are necessary.
https://github.com/electron/electron/blob/v33.2.1/shell/common/platform_util_linux.cc#L342-L347
@NV404 I'm replacing this with just one line shell.showItemInFolder(...)
. Let me know if you think otherwise.
throw new Error('File path is required.'); | ||
} | ||
|
||
const resolvedPath = path.resolve(filePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.resolve
here will not do anything useful since it works with the app process's CWD(probably /
) and resolving the given path against it doesn't make much sense
|
||
const resolvedPath = path.resolve(filePath); | ||
|
||
if (!fs.existsSync(resolvedPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not worth the extra delay since when this IPC address if used right, this case will rarely happen.
@@ -227,6 +227,12 @@ const CollectionItem = ({ item, collection, searchText }) => { | |||
} | |||
}; | |||
|
|||
const handleShowInFolder = () => { | |||
dispatch(showInFolder(item.pathname)).catch((error) => { | |||
toast.error('Error opening the folder:', error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toast.error
doesn't take the 2nd arg(probably confused with console.error
I assume)
https://react-hot-toast.com/docs/toast#error
f3b2a59
to
7613777
Compare
7613777
to
29f51aa
Compare
Tested on Mac. Need to test on Linux and Windows |
Prefer merge-commit, no Squash and merge |
Duplicate of #3698
Closes #3541
Description
On clicking the triple-dot menu(kebab menu?) on a Folder or a Request, a new menu-item named
Show in Folder
is added which opens it in the native file-browser(Finder, File-Explorer, Nautilus, Ranger, etc.)