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
parent 1c3b4decb5
commit e62d0ced36
2 changed files with 15 additions and 12 deletions

View file

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

View file

@ -313,7 +313,7 @@ pub struct ProfileOvrCompatibilityModule {
}
impl ProfileOvrCompatibilityModule {
fn default_for_uuid(uuid: &str) -> Self {
pub fn default_for_uuid(uuid: &str) -> Self {
let mod_type = OvrCompatibilityModuleType::default();
Self {
mod_type,
@ -322,6 +322,15 @@ impl ProfileOvrCompatibilityModule {
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 {
@ -453,8 +462,8 @@ impl Profile {
pub fn env_vars_full(&self) -> Vec<String> {
vec![
// format!(
// "VR_OVERRIDE={opencomp}/build",
// opencomp = self.opencomposite_path,
// "VR_OVERRIDE={}",
// self.ovr_comp.runtime_dir(),
// ),
self.xr_runtime_json_env_var(),
format!(