Skip to content

Commit

Permalink
rename previously linux-only function to include BSDs
Browse files Browse the repository at this point in the history
  • Loading branch information
hrkfdn authored and amodm committed Mar 31, 2019
1 parent 014af16 commit 28ed7b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Currently state of platform support is:


* macos => default, as well as browsers listed under [Browser](enum.Browser.html) * macos => default, as well as browsers listed under [Browser](enum.Browser.html)
* windows => default browser only * windows => default browser only
* linux => default browser only (uses $BROWSER env var, failing back to xdg-open, gvfs-open, gnome-open, whichever works first) * linux/*bsd => default browser only (uses $BROWSER env var, failing back to xdg-open, gvfs-open, gnome-open, whichever works first)
* android => not supported right now * android => not supported right now
* ios => not supported right now * ios => not supported right now


Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fn open_browser_internal(browser: Browser, url: &str) -> Result<Output> {
#[inline] #[inline]
fn open_browser_internal(browser: Browser, url: &str) -> Result<Output> { fn open_browser_internal(browser: Browser, url: &str) -> Result<Output> {
match browser { match browser {
Browser::Default => open_on_linux_using_browser_env(url) Browser::Default => open_on_unix_using_browser_env(url)
.or_else(|_| -> Result<Output> { Command::new("xdg-open").arg(url).output() }) .or_else(|_| -> Result<Output> { Command::new("xdg-open").arg(url).output() })
.or_else(|_| -> Result<Output> { Command::new("gvfs-open").arg(url).output() }) .or_else(|_| -> Result<Output> { Command::new("gvfs-open").arg(url).output() })
.or_else(|_| -> Result<Output> { Command::new("gnome-open").arg(url).output() }), .or_else(|_| -> Result<Output> { Command::new("gnome-open").arg(url).output() }),
Expand All @@ -266,7 +266,7 @@ fn open_browser_internal(browser: Browser, url: &str) -> Result<Output> {
target_os = "netbsd", target_os = "netbsd",
target_os = "openbsd" target_os = "openbsd"
))] ))]
fn open_on_linux_using_browser_env(url: &str) -> Result<Output> { fn open_on_unix_using_browser_env(url: &str) -> Result<Output> {
let browsers = ::std::env::var("BROWSER") let browsers = ::std::env::var("BROWSER")
.map_err(|_| -> Error { Error::new(ErrorKind::NotFound, "BROWSER env not set") })?; .map_err(|_| -> Error { Error::new(ErrorKind::NotFound, "BROWSER env not set") })?;
for browser in browsers.split(':') { for browser in browsers.split(':') {
Expand Down

0 comments on commit 28ed7b9

Please sign in to comment.