This crate provides the [open
] function, which opens a file or link with the default program
configured on the system.
# fn main() -> Result<(), ::opener::OpenError> {
// open a website
opener::open("https://www.rust-lang.org")?;
// open a file
opener::open("../Cargo.toml")?;
# Ok(())
# }
Platform Implementation Details
On Windows the ShellExecuteW
Windows API function is used. On Mac the system open
command is
used. On other platforms, the xdg-open
script is used. The system xdg-open
is not used;
instead a version is embedded within this library.