openvr: fix autolaunch

This commit is contained in:
galister
2024-06-14 09:28:32 +09:00
parent 40383f2529
commit 8fb9ef4a05

View File

@@ -21,7 +21,7 @@ use clap::Parser;
use flexi_logger::{Duplicate, FileSpec, LogSpecification}; use flexi_logger::{Duplicate, FileSpec, LogSpecification};
/// The lightweight desktop overlay for OpenVR and OpenXR /// The lightweight desktop overlay for OpenVR and OpenXR
#[derive(Parser, Debug)] #[derive(Default, Parser, Debug)]
#[command(version, about, long_about = None)] #[command(version, about, long_about = None)]
struct Args { struct Args {
#[cfg(feature = "openvr")] #[cfg(feature = "openvr")]
@@ -57,7 +57,11 @@ struct Args {
} }
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = Args::parse(); let mut args = if std::env::args().skip(1).any(|a| !a.is_empty()) {
Args::parse()
} else {
Args::default()
};
if !args.multi && !ensure_single_instance(args.replace) { if !args.multi && !ensure_single_instance(args.replace) {
println!("Looks like WlxOverlay-S is already running."); println!("Looks like WlxOverlay-S is already running.");