pico_driver/
resolution.rs1use pico_common::Driver;
2use std::{env::current_exe, path::PathBuf};
3
4#[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd)]
6pub enum Resolution {
7 Default,
9 AppRoot,
11 Custom(PathBuf),
13}
14
15impl Resolution {
16 pub fn get_path(&self, driver: Driver) -> PathBuf {
18 let binary_name = driver.get_binary_name();
19
20 match self {
21 Resolution::Default => PathBuf::from(binary_name),
22 Resolution::AppRoot => current_exe()
23 .expect("current_exe path could not be found")
24 .parent()
25 .expect("current_exe path does not have parent")
26 .join(binary_name),
27 Resolution::Custom(path) => path.join(binary_name),
28 }
29 }
30}
31
32impl Default for Resolution {
33 fn default() -> Self {
34 Resolution::Default
35 }
36}