Skip to content

Commit 70c1151

Browse files
author
rony
committed
fix(win): gate Linux-only helper plumbing off Windows (clippy dead_code)
The Windows clippy gate (-D warnings) failed: since Task 2 routes Windows SMART installs through winget (not pkexec_install_deps), HELPER_PATH, resolve_helper_path and pkexec_install_deps became dead code on Windows. Gate the first two to cfg(not(windows)) (Linux+macOS still use them) and pkexec_install_deps to cfg(linux) (macOS=brew, Windows=winget). Cross-platform execute_plan/user_zones keep Path/PathBuf imports alive on Windows. (Local clippy runs on Linux where these ARE used — only the Windows CI catches this, which is why it exists.)
1 parent 68864d5 commit 70c1151

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src-tauri/src/execute.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ use std::process::Command;
1717
#[cfg(target_os = "linux")]
1818
use std::process::Stdio;
1919

20-
/// Installed location of the privileged helper.
20+
/// Installed location of the privileged helper (Linux/macOS only — Windows
21+
/// elevates in-process via PowerShell and never invokes the helper binary).
22+
#[cfg(not(target_os = "windows"))]
2123
pub const HELPER_PATH: &str = "/usr/lib/freeyourdisk/freeyourdisk-helper";
2224

2325
/// Resolve the helper binary: the installed path in production, or a sibling of
24-
/// the running executable when developing (`cargo tauri dev`).
26+
/// the running executable when developing (`cargo tauri dev`). Linux/macOS only.
27+
#[cfg(not(target_os = "windows"))]
2528
pub fn resolve_helper_path() -> PathBuf {
2629
let installed = PathBuf::from(HELPER_PATH);
2730
if installed.exists() {
@@ -322,7 +325,8 @@ pub fn pkexec_smart(devices: &[String]) -> Vec<SmartInfo> {
322325
/// Install SMART tools as root via the helper (`install-deps <manager> <pkg>…`).
323326
/// The helper re-validates the package names against its own allowlist.
324327
/// (Linux only — macOS installs via Homebrew at user level.)
325-
#[cfg(not(target_os = "macos"))]
328+
// Linux only: macOS installs via brew, Windows via winget (winget_install_smart).
329+
#[cfg(target_os = "linux")]
326330
pub fn pkexec_install_deps(manager: &str, packages: &[String]) -> InstallReport {
327331
let mut cmd = Command::new("pkexec");
328332
cmd.arg(resolve_helper_path())

0 commit comments

Comments
 (0)