1use std::path::PathBuf;
4
5use browser_locations_core::{
6 Browser, discover_browser, locate_any_latest, locate_any_stable, locate_browser,
7};
8pub use browser_locations_core::{BrowserLocation, LocateError, ReleaseChannel, define_getter};
9
10pub fn locate(channel: ReleaseChannel) -> Result<BrowserLocation, LocateError> {
16 locate_browser(Browser::Brave, channel)
17}
18
19#[must_use]
21pub fn discover() -> Vec<BrowserLocation> {
22 discover_browser(Browser::Brave)
23}
24
25define_getter!(
26 get_brave_path,
27 ReleaseChannel::Stable,
28 "Returns the stable Brave executable path."
29);
30define_getter!(
31 get_brave_beta_path,
32 ReleaseChannel::Beta,
33 "Returns the Brave beta executable path."
34);
35define_getter!(
36 get_brave_nightly_path,
37 ReleaseChannel::Nightly,
38 "Returns the Brave nightly executable path."
39);
40
41pub fn get_any_brave_stable() -> Result<PathBuf, LocateError> {
47 locate_any_stable(Browser::Brave).map(|location| location.path)
48}
49
50pub fn get_any_brave_latest() -> Result<PathBuf, LocateError> {
56 locate_any_latest(Browser::Brave).map(|location| location.path)
57}