Byron/open-rs

Open a path or URL with the system-defined program

Rust

403

275 commits

updated Sep 10, 2026

See the code

README

Crates.io cross-platform-testing

Use this library to open a path or URL using the program configured on the system. It is equivalent to running one of the following:

# macOS
$ open <path-or-url>
# Windows
$ start <path-or-url>
# Linux
$ xdg-open <path-or-url> || gio open <path-or-url> || gnome-open <path-or-url> || kde-open <path-or-url>
# WSL
$ powershell.exe -NoProfile -Command "Start-Process -FilePath '<path-or-url>'" || xdg-open <path-or-url> || gio open <path-or-url> || gnome-open <path-or-url> || kde-open <path-or-url>

To open a web browser, see the webbrowser crate, which offers functionality for that specific case.

Library Usage

Add this to your Cargo.toml

[dependencies]
open = "5"

…and open something using…

open::that("https://rust-lang.org");

…or, open something with an application of your choice

open::with("https://rust-lang.org", "firefox");

Follow this link for the API docs.

Binary Usage

This crate also implements a binary that acts like an opener itself.

cargo run 'file to open'

Credits

The implementation is based on the respective functionality of Cargo, but was improved to allow some error handling.

Contributors

(top 30 of 39)

Byron

199 commits

hybras

13 commits

amrbashir

9 commits

apogeeoak

6 commits

Byron/open-rs

Open a path or URL with the system-defined program

Rust

403

275 commits

updated Sep 10, 2026

See the code

README

Crates.io cross-platform-testing

Use this library to open a path or URL using the program configured on the system. It is equivalent to running one of the following:

# macOS
$ open <path-or-url>
# Windows
$ start <path-or-url>
# Linux
$ xdg-open <path-or-url> || gio open <path-or-url> || gnome-open <path-or-url> || kde-open <path-or-url>
# WSL
$ powershell.exe -NoProfile -Command "Start-Process -FilePath '<path-or-url>'" || xdg-open <path-or-url> || gio open <path-or-url> || gnome-open <path-or-url> || kde-open <path-or-url>

To open a web browser, see the webbrowser crate, which offers functionality for that specific case.

Library Usage

Add this to your Cargo.toml

[dependencies]
open = "5"

…and open something using…

open::that("https://rust-lang.org");

…or, open something with an application of your choice

open::with("https://rust-lang.org", "firefox");

Follow this link for the API docs.

Binary Usage

This crate also implements a binary that acts like an opener itself.

cargo run 'file to open'

Credits

The implementation is based on the respective functionality of Cargo, but was improved to allow some error handling.

Contributors

(top 30 of 39)

Byron

199 commits

hybras

13 commits

amrbashir

9 commits

apogeeoak

6 commits

Languages

Rust

99.3%