mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-04-20 11:35:48 +00:00
Merge branch 'fix/ditch-expect-dialog' into 'main'
fix: ditch expect dialog (broken in some edge cases) See merge request gabmus/rex2!7
This commit is contained in:
commit
9f1e2edb98
19 changed files with 66 additions and 260 deletions
177
Cargo.lock
generated
177
Cargo.lock
generated
|
@ -32,12 +32,6 @@ version = "1.0.71"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8"
|
||||
|
||||
[[package]]
|
||||
name = "ascii"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16"
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.71"
|
||||
|
@ -162,37 +156,6 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.24.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block",
|
||||
"cocoa-foundation",
|
||||
"core-foundation",
|
||||
"core-graphics",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cocoa-foundation"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "931d3837c286f56e3c58423ce4eba12d08db2374461a785c86f672b08b5650d6"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"block",
|
||||
"core-foundation",
|
||||
"core-graphics-types",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
"objc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.3"
|
||||
|
@ -209,63 +172,6 @@ version = "0.8.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa"
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics"
|
||||
version = "0.22.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
"core-graphics-types",
|
||||
"foreign-types",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-graphics-types"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cty"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35"
|
||||
|
||||
[[package]]
|
||||
name = "dirs-next"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"dirs-sys-next",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dirs-sys-next"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_users",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91"
|
||||
|
||||
[[package]]
|
||||
name = "encoding_rs"
|
||||
version = "0.8.32"
|
||||
|
@ -302,15 +208,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "expect-dialog"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2cffe942687cc5740f3509be69c5a8d110815938c4eec39618107475b9eb8d9c"
|
||||
dependencies = [
|
||||
"native-dialog",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fastrand"
|
||||
version = "1.9.0"
|
||||
|
@ -1124,27 +1021,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-dialog"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1bbf55edb2747e4e4b3a9cd3989194b88aae32274b4422635dcf98aa6e84197b"
|
||||
dependencies = [
|
||||
"ascii",
|
||||
"block",
|
||||
"cocoa",
|
||||
"dirs-next",
|
||||
"objc",
|
||||
"objc-foundation",
|
||||
"objc_id",
|
||||
"once_cell",
|
||||
"raw-window-handle",
|
||||
"thiserror",
|
||||
"wfd",
|
||||
"which",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.11"
|
||||
|
@ -1474,24 +1350,6 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "raw-window-handle"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41"
|
||||
dependencies = [
|
||||
"cty",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.3.5"
|
||||
|
@ -1501,17 +1359,6 @@ dependencies = [
|
|||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redox_users"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall 0.2.16",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.9.1"
|
||||
|
@ -1623,7 +1470,6 @@ name = "rex2"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"expect-dialog",
|
||||
"gettext-rs",
|
||||
"gtk4",
|
||||
"libusb",
|
||||
|
@ -1909,7 +1755,7 @@ dependencies = [
|
|||
"autocfg",
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
"redox_syscall 0.3.5",
|
||||
"redox_syscall",
|
||||
"rustix",
|
||||
"windows-sys",
|
||||
]
|
||||
|
@ -2239,27 +2085,6 @@ dependencies = [
|
|||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wfd"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e713040b67aae5bf1a0ae3e1ebba8cc29ab2b90da9aa1bff6e09031a8a41d7a8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "4.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269"
|
||||
dependencies = [
|
||||
"either",
|
||||
"libc",
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
|
|
|
@ -7,7 +7,6 @@ edition = "2021"
|
|||
|
||||
[dependencies]
|
||||
anyhow = "1.0.71"
|
||||
expect-dialog = "1.0.0"
|
||||
gettext-rs = { version = "0.7.0", features = [
|
||||
"gettext-system"
|
||||
] }
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
use std::path::Path;
|
||||
use expect_dialog::ExpectDialog;
|
||||
|
||||
use crate::runner::Runner;
|
||||
|
||||
pub fn get_adb_install_runner(apk_path: &String) -> Runner {
|
||||
let path = Path::new(apk_path);
|
||||
path.try_exists().expect_dialog("APK file provided does not exist");
|
||||
path.try_exists().expect("APK file provided does not exist");
|
||||
let runner = Runner::new(None, "adb".into(), vec![
|
||||
"install".into(), path.to_str().unwrap().to_string()
|
||||
]);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use expect_dialog::ExpectDialog;
|
||||
use crate::{constants::pkg_data_dir, profile::Profile, runner::Runner};
|
||||
|
||||
pub fn get_build_basalt_runner(profile: Profile) -> Runner {
|
||||
let mut args = vec![
|
||||
profile
|
||||
.features.basalt.path
|
||||
.expect_dialog("Missing basalt path for given profile"),
|
||||
.expect("Missing basalt path for given profile"),
|
||||
profile.prefix,
|
||||
match profile.pull_on_build {
|
||||
true => "1".into(),
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
use crate::{constants::pkg_data_dir, profile::Profile, runner::Runner};
|
||||
use expect_dialog::ExpectDialog;
|
||||
|
||||
pub fn get_build_libsurvive_runner(profile: Profile) -> Runner {
|
||||
let mut args = vec![
|
||||
profile
|
||||
.features.libsurvive.path
|
||||
.expect_dialog("Missing libsurvive path for given profile"),
|
||||
.expect("Missing libsurvive path for given profile"),
|
||||
profile.prefix,
|
||||
match profile.pull_on_build {
|
||||
true => "1".into(),
|
||||
|
|
|
@ -2,7 +2,6 @@ use crate::{
|
|||
constants::CMD_NAME,
|
||||
file_utils::{get_config_dir, get_writer}, profile::Profile,
|
||||
};
|
||||
use expect_dialog::ExpectDialog;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fs::File, io::BufReader};
|
||||
|
||||
|
@ -28,7 +27,7 @@ impl Config {
|
|||
pub fn get_selected_profile(&self, profiles: &Vec<Profile>) -> Profile {
|
||||
match profiles.iter().find(|p| {p.uuid == self.selected_profile_uuid}) {
|
||||
Some(p) => p.clone(),
|
||||
None => profiles.get(0).expect_dialog("No profiles found").clone(),
|
||||
None => profiles.get(0).expect("No profiles found").clone(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +58,7 @@ impl Config {
|
|||
}
|
||||
|
||||
pub fn save(&self) {
|
||||
self.save_to_path(&Self::config_file_path()).expect_dialog("Failed to save config");
|
||||
self.save_to_path(&Self::config_file_path()).expect("Failed to save config");
|
||||
}
|
||||
|
||||
pub fn get_config() -> Self {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use expect_dialog::ExpectDialog;
|
||||
use std::{env, fmt::Display, path::Path};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
@ -69,7 +68,7 @@ pub fn check_dependency(dep: Dependency) -> bool {
|
|||
for dir in match dep.dep_type {
|
||||
DepType::SharedObject => shared_obj_paths(),
|
||||
DepType::Executable => env::var("PATH")
|
||||
.expect_dialog("PATH environment variable not defined")
|
||||
.expect("PATH environment variable not defined")
|
||||
.split(':')
|
||||
.map(str::to_string)
|
||||
.collect(),
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
use std::fmt::Display;
|
||||
|
||||
use expect_dialog::ExpectDialog;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum PhysicalXRDevice {
|
||||
ValveIndex,
|
||||
|
@ -67,31 +65,36 @@ impl Display for PhysicalXRDevice {
|
|||
* Returns a Vec of tuples, each representing (vendor_id, product_id)
|
||||
*/
|
||||
fn list_usb_devs() -> Vec<(u16, u16)> {
|
||||
let ctx = libusb::Context::new().expect_dialog("Failed to create libusb context");
|
||||
let devs = ctx.devices().expect_dialog("Failed to list devices from libusb context");
|
||||
let ctx = libusb::Context::new().expect("Failed to create libusb context");
|
||||
let devs = ctx
|
||||
.devices()
|
||||
.expect("Failed to list devices from libusb context");
|
||||
|
||||
devs.iter().filter_map(|dev|
|
||||
match dev.device_descriptor() {
|
||||
devs.iter()
|
||||
.filter_map(|dev| match dev.device_descriptor() {
|
||||
Err(_) => None,
|
||||
Ok(desc) => Some((desc.vendor_id(), desc.product_id())),
|
||||
}
|
||||
).collect()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn get_xr_usb_devices() -> Vec<PhysicalXRDevice> {
|
||||
list_usb_devs().into_iter().filter_map(|t| match t {
|
||||
(0x28de, 0x2102) => Some(PhysicalXRDevice::ValveIndex),
|
||||
(0x0bb4, 0x2c87) => Some(PhysicalXRDevice::HTCVive),
|
||||
(0x0bb4, 0x0309) => Some(PhysicalXRDevice::HTCVivePro),
|
||||
(0x0bb4, 0x0313) => Some(PhysicalXRDevice::HTCViveCosmos),
|
||||
(0x0bb4, 0x0342) => Some(PhysicalXRDevice::HTCVivePro2),
|
||||
(0x2833, 0x0031) => Some(PhysicalXRDevice::OculusRift),
|
||||
(0x2833, 0x0051) => Some(PhysicalXRDevice::OculusRiftS),
|
||||
(0x1532, 0x0300) => Some(PhysicalXRDevice::RazerHydra),
|
||||
(0x0483, 0x0021) => Some(PhysicalXRDevice::Pimax4K),
|
||||
(0x054c, 0x09af) => Some(PhysicalXRDevice::PlayStationVR),
|
||||
(0x03f0, 0x0c6a) => Some(PhysicalXRDevice::HPReverbG1),
|
||||
(0x03f0, 0x0580) => Some(PhysicalXRDevice::HPReverbG2),
|
||||
_ => None,
|
||||
}).collect()
|
||||
list_usb_devs()
|
||||
.into_iter()
|
||||
.filter_map(|t| match t {
|
||||
(0x28de, 0x2102) => Some(PhysicalXRDevice::ValveIndex),
|
||||
(0x0bb4, 0x2c87) => Some(PhysicalXRDevice::HTCVive),
|
||||
(0x0bb4, 0x0309) => Some(PhysicalXRDevice::HTCVivePro),
|
||||
(0x0bb4, 0x0313) => Some(PhysicalXRDevice::HTCViveCosmos),
|
||||
(0x0bb4, 0x0342) => Some(PhysicalXRDevice::HTCVivePro2),
|
||||
(0x2833, 0x0031) => Some(PhysicalXRDevice::OculusRift),
|
||||
(0x2833, 0x0051) => Some(PhysicalXRDevice::OculusRiftS),
|
||||
(0x1532, 0x0300) => Some(PhysicalXRDevice::RazerHydra),
|
||||
(0x0483, 0x0021) => Some(PhysicalXRDevice::Pimax4K),
|
||||
(0x054c, 0x09af) => Some(PhysicalXRDevice::PlayStationVR),
|
||||
(0x03f0, 0x0c6a) => Some(PhysicalXRDevice::HPReverbG1),
|
||||
(0x03f0, 0x0580) => Some(PhysicalXRDevice::HPReverbG2),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::file_utils::get_writer;
|
||||
use expect_dialog::ExpectDialog;
|
||||
use reqwest::{
|
||||
header::{HeaderMap, USER_AGENT},
|
||||
Method,
|
||||
|
@ -21,7 +20,7 @@ fn client() -> reqwest::blocking::Client {
|
|||
.timeout(TIMEOUT)
|
||||
.default_headers(headers())
|
||||
.build()
|
||||
.expect_dialog("Failed to build reqwest::Client")
|
||||
.expect("Failed to build reqwest::Client")
|
||||
}
|
||||
|
||||
pub fn download_file(url: String, path: String) -> JoinHandle<Result<(), reqwest::Error>> {
|
||||
|
@ -36,12 +35,12 @@ pub fn download_file(url: String, path: String) -> JoinHandle<Result<(), reqwest
|
|||
let mut writer = get_writer(&path);
|
||||
for chunk in res
|
||||
.bytes()
|
||||
.expect_dialog("Could not get HTTP response bytes")
|
||||
.expect("Could not get HTTP response bytes")
|
||||
.chunks(CHUNK_SIZE)
|
||||
{
|
||||
writer.write(chunk).expect_dialog("Failed to write chunk");
|
||||
writer.write(chunk).expect("Failed to write chunk");
|
||||
}
|
||||
writer.flush().expect_dialog("Failed to flush download writer");
|
||||
writer.flush().expect("Failed to flush download writer");
|
||||
Ok(())
|
||||
}
|
||||
Err(e) => Err(e)
|
||||
|
|
|
@ -6,7 +6,6 @@ use crate::{
|
|||
paths::SYSTEM_PREFIX,
|
||||
profile::{Profile, XRServiceType},
|
||||
};
|
||||
use expect_dialog::ExpectDialog;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
|
||||
|
@ -76,7 +75,7 @@ pub fn get_current_active_runtime() -> Option<ActiveRuntime> {
|
|||
fn dump_active_runtime_to_path(active_runtime: &ActiveRuntime, path_s: &String) {
|
||||
let writer = get_writer(path_s);
|
||||
serde_json::to_writer_pretty(writer, active_runtime)
|
||||
.expect_dialog("Unable to save active runtime");
|
||||
.expect("Unable to save active runtime");
|
||||
}
|
||||
|
||||
pub fn dump_current_active_runtime(active_runtime: &ActiveRuntime) {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use expect_dialog::ExpectDialog;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::file_utils::{deserialize_file, get_writer, get_xdg_config_dir};
|
||||
|
@ -46,7 +45,7 @@ pub fn get_monado_autorun_config() -> MonadoAutorunConfig {
|
|||
fn dump_monado_autorun_config_to_path(config: &MonadoAutorunConfig, path_s: &String) {
|
||||
let writer = get_writer(path_s);
|
||||
serde_json::to_writer_pretty(writer, config)
|
||||
.expect_dialog("Unable to save Monado Autorun config");
|
||||
.expect("Unable to save Monado Autorun config");
|
||||
}
|
||||
|
||||
pub fn dump_monado_autorun_config(config: &MonadoAutorunConfig) {
|
||||
|
|
|
@ -5,7 +5,6 @@ use crate::{
|
|||
},
|
||||
profile::Profile,
|
||||
};
|
||||
use expect_dialog::ExpectDialog;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
@ -73,7 +72,7 @@ pub fn get_current_openvrpaths() -> Option<OpenVrPaths> {
|
|||
|
||||
fn dump_openvrpaths_to_path(ovr_paths: &OpenVrPaths, path_s: &String) {
|
||||
let writer = get_writer(path_s);
|
||||
serde_json::to_writer_pretty(writer, ovr_paths).expect_dialog("Unable to save openvrpaths");
|
||||
serde_json::to_writer_pretty(writer, ovr_paths).expect("Unable to save openvrpaths");
|
||||
}
|
||||
|
||||
pub fn dump_current_openvrpaths(ovr_paths: &OpenVrPaths) {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
use std::{fmt::Display, slice::Iter};
|
||||
|
||||
use expect_dialog::ExpectDialog;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::file_utils::{deserialize_file, get_writer, get_xdg_config_dir};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{fmt::Display, slice::Iter};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
|
@ -29,9 +26,7 @@ impl Encoder {
|
|||
}
|
||||
|
||||
pub fn as_vec() -> Vec<Encoder> {
|
||||
vec![
|
||||
Self::X264, Self::Nvenc, Self::Vaapi
|
||||
]
|
||||
vec![Self::X264, Self::Nvenc, Self::Vaapi]
|
||||
}
|
||||
|
||||
pub fn as_number(&self) -> u32 {
|
||||
|
@ -103,7 +98,7 @@ pub fn get_wivrn_config() -> WivrnConfig {
|
|||
|
||||
fn dump_wivrn_config_to_path(config: &WivrnConfig, path_s: &String) {
|
||||
let writer = get_writer(path_s);
|
||||
serde_json::to_writer_pretty(writer, config).expect_dialog("Unable to save WiVRn config");
|
||||
serde_json::to_writer_pretty(writer, config).expect("Unable to save WiVRn config");
|
||||
}
|
||||
|
||||
pub fn dump_wivrn_config(config: &WivrnConfig) {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::{constants::CMD_NAME, runner::Runner};
|
||||
use expect_dialog::ExpectDialog;
|
||||
use std::{
|
||||
env,
|
||||
fs::{self, copy, create_dir_all, remove_dir_all, File, OpenOptions},
|
||||
|
@ -12,7 +11,7 @@ pub fn get_writer(path_s: &String) -> BufWriter<std::fs::File> {
|
|||
match path.parent() {
|
||||
Some(parent) => {
|
||||
if !parent.is_dir() {
|
||||
create_dir_all(parent).expect_dialog("Could not create dir")
|
||||
create_dir_all(parent).expect("Could not create dir")
|
||||
}
|
||||
}
|
||||
None => {}
|
||||
|
@ -22,7 +21,7 @@ pub fn get_writer(path_s: &String) -> BufWriter<std::fs::File> {
|
|||
.create(true)
|
||||
.truncate(true)
|
||||
.open(path)
|
||||
.expect_dialog("Could not open file");
|
||||
.expect("Could not open file");
|
||||
BufWriter::new(file)
|
||||
}
|
||||
|
||||
|
@ -54,7 +53,7 @@ pub fn deserialize_file<T: serde::de::DeserializeOwned>(path_s: &String) -> Opti
|
|||
}
|
||||
|
||||
pub fn get_home_dir() -> String {
|
||||
env::var("HOME").expect_dialog("HOME env var not defined")
|
||||
env::var("HOME").expect("HOME env var not defined")
|
||||
}
|
||||
|
||||
pub fn get_xdg_config_dir() -> String {
|
||||
|
@ -79,7 +78,7 @@ pub fn get_xdg_cache_dir() -> String {
|
|||
}
|
||||
|
||||
pub fn get_xdg_runtime_dir() -> String {
|
||||
env::var("XDG_RUNTIME_DIR").expect_dialog("XDG_RUNTIME_DIR is not set")
|
||||
env::var("XDG_RUNTIME_DIR").expect("XDG_RUNTIME_DIR is not set")
|
||||
}
|
||||
|
||||
pub fn get_config_dir() -> String {
|
||||
|
@ -112,7 +111,7 @@ pub fn get_backup_dir() -> String {
|
|||
p.to_str().unwrap()
|
||||
);
|
||||
}
|
||||
create_dir_all(p).expect_dialog("Failed to create backups dir");
|
||||
create_dir_all(p).expect("Failed to create backups dir");
|
||||
}
|
||||
p.to_str().unwrap().to_string()
|
||||
}
|
||||
|
@ -124,10 +123,10 @@ pub fn set_file_readonly(path_s: &String, readonly: bool) {
|
|||
return;
|
||||
}
|
||||
let mut perms = fs::metadata(path)
|
||||
.expect_dialog("Could not get metadata for file")
|
||||
.expect("Could not get metadata for file")
|
||||
.permissions();
|
||||
perms.set_readonly(readonly);
|
||||
fs::set_permissions(path, perms).expect_dialog("Could not set permissions for file")
|
||||
fs::set_permissions(path, perms).expect("Could not set permissions for file")
|
||||
}
|
||||
|
||||
pub fn setcap_cap_sys_nice_eip(file: String) {
|
||||
|
@ -170,11 +169,11 @@ pub fn copy_file(source_s: &String, dest_s: &String) {
|
|||
let parent = dest.parent();
|
||||
if parent.is_some() {
|
||||
if !parent.unwrap().is_dir() {
|
||||
create_dir_all(parent.unwrap()).expect_dialog(
|
||||
create_dir_all(parent.unwrap()).expect(
|
||||
format!("Failed to create dir {}", parent.unwrap().to_str().unwrap()).as_str(),
|
||||
);
|
||||
}
|
||||
}
|
||||
set_file_readonly(dest_s, false);
|
||||
copy(source, dest).expect_dialog(format!("Failed to copy {} to {}", source_s, dest_s).as_str());
|
||||
copy(source, dest).expect(format!("Failed to copy {} to {}", source_s, dest_s).as_str());
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ use crate::{
|
|||
file_utils::{get_data_dir, get_writer},
|
||||
paths::{data_monado_path, data_opencomposite_path, BWRAP_SYSTEM_PREFIX, SYSTEM_PREFIX},
|
||||
};
|
||||
use expect_dialog::ExpectDialog;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashMap, fmt::Display, fs::File, io::BufReader, slice::Iter};
|
||||
use uuid::Uuid;
|
||||
|
@ -202,14 +201,14 @@ impl Profile {
|
|||
}
|
||||
|
||||
pub fn load_profile(path: &String) -> Self {
|
||||
let file = File::open(path).expect_dialog("Unable to open profile");
|
||||
let file = File::open(path).expect("Unable to open profile");
|
||||
let reader = BufReader::new(file);
|
||||
serde_json::from_reader(reader).expect_dialog("Faiuled to deserialize profile")
|
||||
serde_json::from_reader(reader).expect("Faiuled to deserialize profile")
|
||||
}
|
||||
|
||||
pub fn dump_profile(&self, path_s: &String) -> () {
|
||||
let writer = get_writer(path_s);
|
||||
serde_json::to_writer_pretty(writer, self).expect_dialog("Could not write profile")
|
||||
serde_json::to_writer_pretty(writer, self).expect("Could not write profile")
|
||||
}
|
||||
|
||||
pub fn create_duplicate(&self) -> Self {
|
||||
|
|
|
@ -2,7 +2,6 @@ use crate::{
|
|||
file_utils::get_writer,
|
||||
profile::{Profile, XRServiceType},
|
||||
};
|
||||
use expect_dialog::ExpectDialog;
|
||||
use nix::{
|
||||
sys::signal::{kill, Signal::SIGTERM},
|
||||
unistd::Pid,
|
||||
|
@ -55,7 +54,7 @@ macro_rules! logger_thread {
|
|||
match $sender
|
||||
.clone()
|
||||
.lock()
|
||||
.expect_dialog("Could not lock sender")
|
||||
.expect("Could not lock sender")
|
||||
.send(buf)
|
||||
{
|
||||
Ok(_) => {}
|
||||
|
@ -123,14 +122,14 @@ impl Runner {
|
|||
}
|
||||
|
||||
pub fn start(&mut self) {
|
||||
self.try_start().expect_dialog("Failed to execute runner");
|
||||
self.try_start().expect("Failed to execute runner");
|
||||
}
|
||||
|
||||
fn join_threads(&mut self) {
|
||||
loop {
|
||||
match self.threads.pop() {
|
||||
None => break,
|
||||
Some(thread) => thread.join().expect_dialog("Failed to join reader thread"),
|
||||
Some(thread) => thread.join().expect("Failed to join reader thread"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,11 +146,11 @@ impl Runner {
|
|||
let child_pid = Pid::from_raw(
|
||||
proc.id()
|
||||
.try_into()
|
||||
.expect_dialog("Could not convert pid to u32"),
|
||||
.expect("Could not convert pid to u32"),
|
||||
);
|
||||
kill(child_pid, SIGTERM).expect_dialog("Could not send sigterm to process");
|
||||
kill(child_pid, SIGTERM).expect("Could not send sigterm to process");
|
||||
self.join_threads();
|
||||
proc.wait().expect_dialog("Failed to wait for process");
|
||||
proc.wait().expect("Failed to wait for process");
|
||||
}
|
||||
|
||||
pub fn join(&mut self) {
|
||||
|
@ -160,7 +159,7 @@ impl Runner {
|
|||
return;
|
||||
}
|
||||
let mut proc = process.unwrap();
|
||||
proc.wait().expect_dialog("Failed to wait for process");
|
||||
proc.wait().expect("Failed to wait for process");
|
||||
self.join_threads();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ use crate::ui::debug_view::DebugViewInit;
|
|||
use crate::ui::libsurvive_setup_window::LibsurviveSetupMsg;
|
||||
use crate::ui::main_view::{MainView, MainViewInit, MainViewOutMsg};
|
||||
use crate::xr_devices::XRDevices;
|
||||
use expect_dialog::ExpectDialog;
|
||||
use gtk::prelude::*;
|
||||
use relm4::actions::{AccelsPlus, ActionGroupName, RelmAction, RelmActionGroup};
|
||||
use relm4::adw::traits::MessageDialogExt;
|
||||
|
@ -472,7 +471,7 @@ impl SimpleComponent for App {
|
|||
.send(LibsurviveSetupMsg::Present(
|
||||
self.get_selected_profile().clone(),
|
||||
))
|
||||
.expect_dialog("Failed to present Libsurvive Setup Window");
|
||||
.expect("Failed to present Libsurvive Setup Window");
|
||||
}
|
||||
Msg::Quit => {
|
||||
self.application.quit();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use crate::log_level::LogLevel;
|
||||
use crate::log_parser::MonadoLog;
|
||||
use expect_dialog::ExpectDialog;
|
||||
use gtk::prelude::*;
|
||||
use relm4::prelude::*;
|
||||
use relm4::{ComponentSender, SimpleComponent};
|
||||
|
@ -245,7 +244,7 @@ impl SimpleComponent for DebugView {
|
|||
.style_scheme(
|
||||
&sourceview5::StyleSchemeManager::new()
|
||||
.scheme("Adwaita-dark")
|
||||
.expect_dialog("Couldn't find Adwaita-dark style scheme for gtksourceview5"),
|
||||
.expect("Couldn't find Adwaita-dark style scheme for gtksourceview5"),
|
||||
)
|
||||
.build();
|
||||
let search_settings = sourceview5::SearchSettings::builder()
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use crate::{constants::APP_NAME, profile::Profile};
|
||||
use expect_dialog::ExpectDialog;
|
||||
use gtk::prelude::*;
|
||||
use relm4::prelude::*;
|
||||
|
||||
|
@ -111,7 +110,7 @@ impl SimpleComponent for SteamLaunchOptionsBox {
|
|||
}
|
||||
Self::Input::CopyLaunchOptions => {
|
||||
gtk::gdk::Display::default()
|
||||
.expect_dialog("Could not find default display")
|
||||
.expect("Could not find default display")
|
||||
.clipboard()
|
||||
.set_text(self.launch_options.as_str());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue