Skip to main content

arc_locations/
lib.rs

1//! Arc executable discovery helpers.
2
3use 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};
9
10/// Locates an Arc executable for a specific channel.
11///
12/// # Errors
13///
14/// Returns [`LocateError`] if the channel is unsupported or no executable is found.
15pub fn locate(channel: ReleaseChannel) -> Result<BrowserLocation, LocateError> {
16    locate_browser(Browser::Arc, channel)
17}
18
19/// Discovers installed Arc executables.
20#[must_use]
21pub fn discover() -> Vec<BrowserLocation> {
22    discover_browser(Browser::Arc)
23}
24
25/// Returns the default Arc executable path.
26pub fn get_arc_path() -> Result<PathBuf, LocateError> {
27    locate(ReleaseChannel::Default).map(|location| location.path)
28}
29
30/// Returns the best available Arc executable using the stable helper.
31///
32/// # Errors
33///
34/// Returns [`LocateError`] if no installed executable is found.
35pub fn get_any_arc_stable() -> Result<PathBuf, LocateError> {
36    locate_any_stable(Browser::Arc).map(|location| location.path)
37}
38
39/// Returns the best available Arc executable, preferring the newest channel first.
40///
41/// # Errors
42///
43/// Returns [`LocateError`] if no installed executable is found.
44pub fn get_any_arc_latest() -> Result<PathBuf, LocateError> {
45    locate_any_latest(Browser::Arc).map(|location| location.path)
46}