mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-01 05:38:44 +00:00
chore: move ipc file path function to XRServiceType
This commit is contained in:
parent
943fc151f7
commit
65cdddbb98
3 changed files with 15 additions and 14 deletions
11
src/paths.rs
11
src/paths.rs
|
@ -1,4 +1,4 @@
|
|||
use crate::{constants::CMD_NAME, profile::XRServiceType, xdg::XDG};
|
||||
use crate::{constants::CMD_NAME, xdg::XDG};
|
||||
use std::{
|
||||
env,
|
||||
fs::create_dir_all,
|
||||
|
@ -83,15 +83,6 @@ pub fn get_exec_prefix() -> PathBuf {
|
|||
.into()
|
||||
}
|
||||
|
||||
pub fn get_ipc_file_path(xrservice_type: &XRServiceType) -> PathBuf {
|
||||
XDG.get_runtime_directory()
|
||||
.expect("XDG runtime directory is not available")
|
||||
.join(match xrservice_type {
|
||||
XRServiceType::Monado => "monado_comp_ipc",
|
||||
XRServiceType::Wivrn => "wivrn_comp_ipc",
|
||||
})
|
||||
}
|
||||
|
||||
pub fn get_steamvr_bin_dir_path() -> PathBuf {
|
||||
XDG.get_data_home()
|
||||
.join("Steam/steamapps/common/SteamVR/bin/linux64")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::{
|
||||
file_utils::get_writer,
|
||||
paths::{get_data_dir, get_ipc_file_path, BWRAP_SYSTEM_PREFIX, SYSTEM_PREFIX},
|
||||
paths::{get_data_dir, BWRAP_SYSTEM_PREFIX, SYSTEM_PREFIX},
|
||||
xdg::XDG,
|
||||
};
|
||||
use nix::NixPath;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -40,6 +41,15 @@ impl XRServiceType {
|
|||
Self::Wivrn => "wivrn/libmonado.so",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ipc_file_path(&self) -> PathBuf {
|
||||
XDG.get_runtime_directory()
|
||||
.expect("XDG runtime directory is not available")
|
||||
.join(match self {
|
||||
XRServiceType::Monado => "monado_comp_ipc",
|
||||
XRServiceType::Wivrn => "wivrn_comp_ipc",
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&str> for XRServiceType {
|
||||
|
@ -354,7 +364,7 @@ impl Profile {
|
|||
self.xr_runtime_json_env_var(),
|
||||
format!(
|
||||
"PRESSURE_VESSEL_FILESYSTEMS_RW=\"{path}\"",
|
||||
path = get_ipc_file_path(&self.xrservice_type).to_string_lossy(),
|
||||
path = self.xrservice_type.ipc_file_path().to_string_lossy(),
|
||||
),
|
||||
]
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ use crate::{
|
|||
is_appimage::IS_APPIMAGE,
|
||||
linux_distro::LinuxDistro,
|
||||
openxr_prober::is_openxr_ready,
|
||||
paths::{get_data_dir, get_ipc_file_path},
|
||||
paths::get_data_dir,
|
||||
profile::{Profile, XRServiceType},
|
||||
stateless_action,
|
||||
steam_linux_runtime_injector::{
|
||||
|
@ -175,7 +175,7 @@ impl App {
|
|||
self.debug_view.sender().emit(DebugViewMsg::ClearLog);
|
||||
self.xr_devices = vec![];
|
||||
if prof.can_start() {
|
||||
remove_file(get_ipc_file_path(&prof.xrservice_type))
|
||||
remove_file(prof.xrservice_type.ipc_file_path())
|
||||
.is_err()
|
||||
.then(|| println!("Failed to remove xrservice IPC file"));
|
||||
let worker = JobWorker::xrservice_worker_wrap_from_profile(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue