diff --git a/src/builders/build_monado.rs b/src/builders/build_monado.rs index e0d0b53..988639f 100644 --- a/src/builders/build_monado.rs +++ b/src/builders/build_monado.rs @@ -5,7 +5,7 @@ pub fn get_build_monado_runner(profile: Profile) -> Runner { None, format!("{sysdata}/scripts/build_monado.sh", sysdata = PKG_DATA_DIR), vec![ - profile.monado_path, + profile.xrservice_path, profile.prefix, ] ); diff --git a/src/profile.rs b/src/profile.rs index d220000..1e5e37b 100644 --- a/src/profile.rs +++ b/src/profile.rs @@ -6,10 +6,17 @@ use expect_dialog::ExpectDialog; use serde::{Deserialize, Serialize}; use std::{collections::HashMap, fmt::Display, fs::File, io::BufReader}; +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +pub enum XRServiceType { + Monado, + Wivrn, +} + #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub struct Profile { pub name: String, - pub monado_path: String, + pub xrservice_path: String, + pub xrservice_type: XRServiceType, pub opencomposite_path: String, pub libsurvive_path: Option, pub basalt_path: Option, @@ -62,13 +69,15 @@ impl Profile { mod tests { use std::collections::HashMap; + use crate::profile::XRServiceType; + use super::Profile; #[test] fn profile_can_be_loaded() { let profile = Profile::load_profile(&"./test/files/profile.json".to_string()); assert_eq!(profile.name, "Demo profile"); - assert_eq!(profile.monado_path, "/home/user/monado"); + assert_eq!(profile.xrservice_path, "/home/user/monado"); assert_eq!(profile.opencomposite_path, "/home/user/opencomposite"); assert_eq!(profile.prefix, "/home/user/rex2prefix"); assert_eq!( @@ -96,7 +105,8 @@ mod tests { env.insert("XRT_COMPOSITOR_COMPUTE".into(), "1".into()); let p = Profile { name: "Demo profile".into(), - monado_path: String::from("/home/user/monado"), + xrservice_path: String::from("/home/user/monado"), + xrservice_type: XRServiceType::Monado, opencomposite_path: String::from("/home/user/opencomposite"), libsurvive_path: Some(String::from("/home/user/libsurvive")), basalt_path: None, diff --git a/src/profiles/system_valve_index.rs b/src/profiles/system_valve_index.rs index 1e6eb08..1fa2798 100644 --- a/src/profiles/system_valve_index.rs +++ b/src/profiles/system_valve_index.rs @@ -1,4 +1,4 @@ -use crate::{constants::APP_NAME, paths::{data_opencomposite_path, SYSTEM_PREFIX}, profile::Profile}; +use crate::{constants::APP_NAME, paths::{data_opencomposite_path, SYSTEM_PREFIX}, profile::{Profile, XRServiceType}}; use std::collections::HashMap; pub fn system_valve_index_profile() -> Profile { @@ -10,7 +10,8 @@ pub fn system_valve_index_profile() -> Profile { Profile { name: format!("Valve Index (System) - {name} Default", name = APP_NAME), opencomposite_path: data_opencomposite_path(), - monado_path: "".into(), + xrservice_path: "".into(), + xrservice_type: XRServiceType::Monado, libsurvive_path: None, basalt_path: None, mercury_path: None, diff --git a/src/profiles/valve_index.rs b/src/profiles/valve_index.rs index 0ab9061..88e60e8 100644 --- a/src/profiles/valve_index.rs +++ b/src/profiles/valve_index.rs @@ -1,4 +1,4 @@ -use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::Profile, paths::{data_monado_path, data_opencomposite_path, data_libsurvive_path}}; +use crate::{constants::APP_NAME, file_utils::get_data_dir, profile::{Profile, XRServiceType}, paths::{data_monado_path, data_opencomposite_path, data_libsurvive_path}}; use std::collections::HashMap; pub fn valve_index_profile() -> Profile { @@ -12,7 +12,8 @@ pub fn valve_index_profile() -> Profile { environment.insert("LD_LIBRARY_PATH".into(), format!("{pfx}/lib", pfx = prefix)); Profile { name: format!("Valve Index - {name} Default", name = APP_NAME), - monado_path: data_monado_path(), + xrservice_path: data_monado_path(), + xrservice_type: XRServiceType::Monado, opencomposite_path: data_opencomposite_path(), libsurvive_path: Some(data_libsurvive_path()), basalt_path: None, diff --git a/test/files/profile.json b/test/files/profile.json index 3aabfb2..d6b4378 100644 --- a/test/files/profile.json +++ b/test/files/profile.json @@ -1,6 +1,7 @@ { "name": "Demo profile", - "monado_path": "/home/user/monado", + "xrservice_path": "/home/user/monado", + "xrservice_type": "Monado", "opencomposite_path": "/home/user/opencomposite", "libsurvive_path": "/home/user/libsurvive", "basalt_path": null,