use pico_common::Driver;
use std::{env::current_exe, path::PathBuf};
#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd)]
pub enum Resolution {
Default,
AppRoot,
Custom(PathBuf),
}
impl Resolution {
pub fn get_path(&self, driver: Driver) -> PathBuf {
let binary_name = driver.get_binary_name();
match self {
Resolution::Default => PathBuf::from(binary_name),
Resolution::AppRoot => current_exe()
.expect("current_exe path could not be found")
.parent()
.expect("current_exe path does not have parent")
.join(binary_name),
Resolution::Custom(path) => path.join(binary_name),
}
}
}
impl Default for Resolution {
fn default() -> Self {
Resolution::Default
}
}