fix: get ovr compatibility module runtime dir from profile ovr compatibility module struct
Some checks are pending
/ cargo-fmtcheck (push) Waiting to run
/ cargo-clippy (push) Waiting to run
/ cargo-test (push) Waiting to run
/ appimage (push) Waiting to run

This commit is contained in:
Gabriele Musco 2025-01-06 16:51:26 +01:00
commit e62d0ced36
2 changed files with 15 additions and 12 deletions

View file

@ -1,12 +1,11 @@
use std::path::{Path, PathBuf};
use crate::{ use crate::{
paths::get_backup_dir, paths::get_backup_dir,
profile::{OvrCompatibilityModuleType, Profile}, profile::Profile,
util::file_utils::{copy_file, deserialize_file, get_writer, set_file_readonly}, util::file_utils::{copy_file, deserialize_file, get_writer, set_file_readonly},
xdg::XDG, xdg::XDG,
}; };
use serde::{ser::Error, Deserialize, Serialize}; use serde::{ser::Error, Deserialize, Serialize};
use std::path::{Path, PathBuf};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct OpenVrPaths { pub struct OpenVrPaths {
@ -98,12 +97,7 @@ pub fn build_profile_openvrpaths(profile: &Profile) -> OpenVrPaths {
external_drivers: None, external_drivers: None,
jsonid: "vrpathreg".into(), jsonid: "vrpathreg".into(),
log: vec![datadir.join("Steam/logs")], log: vec![datadir.join("Steam/logs")],
runtime: match profile.ovr_comp.mod_type { runtime: vec![profile.ovr_comp.runtime_dir()],
OvrCompatibilityModuleType::Opencomposite => vec![profile.ovr_comp.path.join("build")],
OvrCompatibilityModuleType::Xrizer => {
vec![profile.ovr_comp.path.join("target/release")]
}
},
version: 1, version: 1,
} }
} }

View file

@ -313,7 +313,7 @@ pub struct ProfileOvrCompatibilityModule {
} }
impl ProfileOvrCompatibilityModule { impl ProfileOvrCompatibilityModule {
fn default_for_uuid(uuid: &str) -> Self { pub fn default_for_uuid(uuid: &str) -> Self {
let mod_type = OvrCompatibilityModuleType::default(); let mod_type = OvrCompatibilityModuleType::default();
Self { Self {
mod_type, mod_type,
@ -322,6 +322,15 @@ impl ProfileOvrCompatibilityModule {
path: get_data_dir().join(uuid).join(mod_type.to_string()), path: get_data_dir().join(uuid).join(mod_type.to_string()),
} }
} }
/// get the directory corresponding to the openvr runtime.
/// this should correspond to the build output directory
pub fn runtime_dir(&self) -> PathBuf {
match self.mod_type {
OvrCompatibilityModuleType::Opencomposite => self.path.join("build"),
OvrCompatibilityModuleType::Xrizer => self.path.join("target/release"),
}
}
} }
impl Default for ProfileOvrCompatibilityModule { impl Default for ProfileOvrCompatibilityModule {
@ -453,8 +462,8 @@ impl Profile {
pub fn env_vars_full(&self) -> Vec<String> { pub fn env_vars_full(&self) -> Vec<String> {
vec![ vec![
// format!( // format!(
// "VR_OVERRIDE={opencomp}/build", // "VR_OVERRIDE={}",
// opencomp = self.opencomposite_path, // self.ovr_comp.runtime_dir(),
// ), // ),
self.xr_runtime_json_env_var(), self.xr_runtime_json_env_var(),
format!( format!(