From 34acc46c12d9cf562fbea7c286232e1e4363754e Mon Sep 17 00:00:00 2001 From: Psychotoxical Date: Wed, 15 Apr 2026 20:01:17 +0200 Subject: [PATCH] fix(cli): suppress dead-code warnings on Windows for Linux-only helpers Wrap tauri_identifier, single_instance_bus_name and single_instance_object_path with #[cfg(target_os = "linux")] since they are only reachable via D-Bus paths. Move the argv collection into the linux-only block in lib.rs for the same reason. Co-Authored-By: Claude Sonnet 4.6 --- src-tauri/src/cli.rs | 3 +++ src-tauri/src/lib.rs | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/cli.rs b/src-tauri/src/cli.rs index 84d226db..83db76d1 100644 --- a/src-tauri/src/cli.rs +++ b/src-tauri/src/cli.rs @@ -517,6 +517,7 @@ fn print_search_human(v: &Value) { } } +#[cfg(target_os = "linux")] fn tauri_identifier() -> &'static str { static ID: OnceLock = OnceLock::new(); ID.get_or_init(|| { @@ -531,10 +532,12 @@ fn tauri_identifier() -> &'static str { .as_str() } +#[cfg(target_os = "linux")] fn single_instance_bus_name() -> String { format!("{}.SingleInstance", tauri_identifier()) } +#[cfg(target_os = "linux")] fn single_instance_object_path(dbus_name: &str) -> String { let mut dbus_path = dbus_name.replace('.', "/").replace('-', "_"); if !dbus_path.starts_with('/') { diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 09b29e19..23c62eff 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -2253,11 +2253,10 @@ fn is_tiling_wm_cmd() -> bool { } pub fn run() { - let argv: Vec = std::env::args().collect(); - // Linux: second `psysonic --player …` forwards over D-Bus before heavy startup. #[cfg(target_os = "linux")] { + let argv: Vec = std::env::args().collect(); if crate::cli::parse_cli_command(&argv).is_some() { match crate::cli::linux_try_forward_player_cli_secondary(&argv) { Ok(crate::cli::LinuxPlayerForwardResult::Forwarded) => std::process::exit(0),