Seeker14491 / opener

Open a file or link in the system default program.
Apache License 2.0
49 stars 10 forks source link

Reveal file in file explorer #17

Closed bash closed 1 year ago

bash commented 1 year ago

Hi, I'm using this library in my rusty GUI for magic-wormhole.

One feature that I was missing is a function that opens the file explorer and reveals the file in its containing folder instead of opening it. On Windows and macOS this is fairly easy to do. I'm not sure how easy this is on other systems.

I would love to to contribute a PR if you think that this is in scope for this crate.

Seeker14491 commented 1 year ago

I think this functionality would be great! We'd need to support Linux too though. I read that Electron implements this in Linux by using D-Bus, but it falls back to calling xdg-open with the parent directory if it fails. I think we could do something similar: try using D-Bus, and if it fails, fall back to calling our opener::open() function with the parent folder of the file we meant to reveal.