feat: bwrap path for system profiles for XR_RUNTIME_JSON

This commit is contained in:
Gabriele Musco 2023-06-17 22:50:18 +02:00
commit cc157862fb
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE
3 changed files with 12 additions and 4 deletions

View file

@ -11,3 +11,8 @@ pub fn data_monado_path() -> String {
pub fn data_libsurvive_path() -> String {
format!("{data}/libsurvive", data = get_data_dir())
}
pub const SYSTEM_PREFIX: &str = "/usr";
/** System prefix inside a bubblewrap environment (flatpak or pressure vessel) */
pub const BWRAP_SYSTEM_PREFIX: &str = "/run/host/usr";

View file

@ -1,4 +1,4 @@
use crate::file_utils::get_writer;
use crate::{file_utils::get_writer, paths::{SYSTEM_PREFIX, BWRAP_SYSTEM_PREFIX}};
use expect_dialog::ExpectDialog;
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, fmt::Display, fs::File, io::BufReader};
@ -31,7 +31,10 @@ impl Profile {
let mut opts = vec![];
opts.push(format!(
"XR_RUNTIME_JSON={prefix}/share/openxr/1/openxr_monado.json",
prefix = self.prefix
prefix = match self.prefix.as_str() {
SYSTEM_PREFIX => BWRAP_SYSTEM_PREFIX,
other => other,
}
));
opts.push(format!(
"PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/monado_comp_ipc"

View file

@ -1,4 +1,4 @@
use crate::{constants::APP_NAME, paths::data_opencomposite_path, profile::Profile};
use crate::{constants::APP_NAME, paths::{data_opencomposite_path, SYSTEM_PREFIX}, profile::Profile};
use std::collections::HashMap;
pub fn system_valve_index_profile() -> Profile {
@ -18,7 +18,7 @@ pub fn system_valve_index_profile() -> Profile {
mercury_enabled: false,
basalt_enabled: false,
environment,
prefix: "/usr".into(),
prefix: SYSTEM_PREFIX.into(),
can_be_built: false,
}
}