|
18 | 18 | //! |----------|-----------|----------|-------------|
|
19 | 19 | //! | macos | ✅ | default + [others](https://docs.rs/webbrowser/latest/webbrowser/enum.Browser.html) | ✅ |
|
20 | 20 | //! | windows | ✅ | default only | ✅ |
|
21 |
| -//! | linux/wsl/*bsd | ✅ | default only (respects $BROWSER env var, so can be used with other browsers) | ✅ | |
| 21 | +//! | linux/wsl | ✅ | default only (respects $BROWSER env var, so can be used with other browsers) | ✅ | |
22 | 22 | //! | android | ✅ | default only | ✅ |
|
23 | 23 | //! | ios | ✅ | default only | ✅ |
|
24 | 24 | //! | wasm | ✅ | default only | ✅ |
|
25 |
| -//! | haiku | ✅ (experimental) | default only | ❌ | |
26 |
| -//! | aix | ✅ (experimental) | default only | ❌ | |
27 |
| -//! | illumos | ✅ (experimental) | default only | ❌ | |
| 25 | +//! | unix (*bsd, aix etc.) | ✅ | default only (respects $BROWSER env var, so can be used with other browsers) | Manual | |
28 | 26 | //!
|
29 | 27 | //! ## Consistent Behaviour
|
30 | 28 | //! `webbrowser` defines consistent behaviour on all platforms as follows:
|
|
47 | 45 | #[cfg_attr(target_family = "wasm", path = "wasm.rs")]
|
48 | 46 | #[cfg_attr(windows, path = "windows.rs")]
|
49 | 47 | #[cfg_attr(
|
50 |
| - any( |
51 |
| - target_os = "aix", |
52 |
| - target_os = "linux", |
53 |
| - target_os = "freebsd", |
54 |
| - target_os = "netbsd", |
55 |
| - target_os = "openbsd", |
56 |
| - target_os = "haiku", |
57 |
| - target_os = "illumos" |
| 48 | + all( |
| 49 | + unix, |
| 50 | + not(any( |
| 51 | + target_os = "ios", |
| 52 | + target_os = "tvos", |
| 53 | + target_os = "macos", |
| 54 | + target_os = "android", |
| 55 | + target_family = "wasm", |
| 56 | + windows, |
| 57 | + )), |
58 | 58 | ),
|
59 | 59 | path = "unix.rs"
|
60 | 60 | )]
|
61 | 61 | mod os;
|
62 | 62 |
|
63 |
| -#[cfg(not(any( |
64 |
| - target_os = "aix", |
65 |
| - target_os = "android", |
66 |
| - target_os = "windows", |
67 |
| - target_os = "macos", |
68 |
| - target_os = "linux", |
69 |
| - target_os = "freebsd", |
70 |
| - target_os = "netbsd", |
71 |
| - target_os = "openbsd", |
72 |
| - target_os = "haiku", |
73 |
| - target_os = "illumos", |
74 |
| - target_os = "ios", |
75 |
| - target_arch = "wasm32" |
76 |
| -)))] |
77 |
| -compile_error!( |
78 |
| - "Only Windows, Mac OS, iOS, Linux, *BSD, Haiku, AIX, illumos and Wasm32 are currently supported" |
79 |
| -); |
80 |
| - |
81 | 63 | #[cfg(any(
|
82 |
| - target_os = "aix", |
83 |
| - target_os = "linux", |
84 |
| - target_os = "freebsd", |
85 |
| - target_os = "netbsd", |
86 |
| - target_os = "openbsd", |
87 |
| - target_os = "haiku", |
88 |
| - target_os = "illumos", |
89 |
| - target_os = "windows" |
| 64 | + windows, |
| 65 | + all( |
| 66 | + unix, |
| 67 | + not(any( |
| 68 | + target_os = "ios", |
| 69 | + target_os = "tvos", |
| 70 | + target_os = "macos", |
| 71 | + target_os = "android", |
| 72 | + target_family = "wasm", |
| 73 | + )), |
| 74 | + ), |
90 | 75 | ))]
|
91 | 76 | pub(crate) mod common;
|
92 | 77 |
|
@@ -328,7 +313,19 @@ pub fn open_browser_with_options(
|
328 | 313 | ));
|
329 | 314 | }
|
330 | 315 |
|
331 |
| - os::open_browser_internal(browser, &target, options) |
| 316 | + if cfg!(any( |
| 317 | + target_os = "ios", |
| 318 | + target_os = "tvos", |
| 319 | + target_os = "macos", |
| 320 | + target_os = "android", |
| 321 | + target_family = "wasm", |
| 322 | + windows, |
| 323 | + unix, |
| 324 | + )) { |
| 325 | + os::open_browser_internal(browser, &target, options) |
| 326 | + } else { |
| 327 | + Err(Error::new(ErrorKind::NotFound, "unsupported platform")) |
| 328 | + } |
332 | 329 | }
|
333 | 330 |
|
334 | 331 | /// The link we're trying to open, represented as a URL. Local files get represented
|
|
0 commit comments