Crate opener

source ·
Expand description

This crate provides the open function, which opens a file or link with the default program configured on the system:

// open a website
opener::open("https://www.rust-lang.org")?;

// open a file
opener::open("../Cargo.toml")?;

An open_browser function is also provided, for when you intend on opening a file or link in a browser, specifically. This function works like the open function, but explicitly allows overriding the browser launched by setting the $BROWSER environment variable.

§Crate features

  • reveal - Enables usage of the reveal function. On Linux this will pull in the dbus crate. If the dbus-vendored feature is enabled (which it is by default), dbus will use static linking. Otherwise it will be dynamically linked, and some system dependencies will be required to build dbus and also to run any built binaries. Refer to the dbus docs for the specifics.
  • dbus-vendored - See the reveal feature.

Enums§

  • An error type representing the failure to open a path. Possibly returned by the open function.

Functions§

  • Opens a file or link with the system default program.
  • Opens a file or link with the system default program, using the BROWSER environment variable when set.
  • revealreveal
    Opens the default file explorer and reveals a file or folder in its containing folder.