Skip to content

Commit 617660f

Browse files
committed
fix: multi-platform build errors and warnings
1 parent 3225a63 commit 617660f

5 files changed

Lines changed: 14 additions & 6 deletions

File tree

src-tauri/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ serde_json = "1"
2121
sha2 = "0.10"
2222
tokio = { version = "1", features = ["full"] }
2323
uuid = { version = "1", features = ["v4"] }
24-
winapi = { version = "0.3.9", features = ["winioctl", "fileapi", "winnt", "handleapi", "errhandlingapi"] }
2524

2625
[target.'cfg(target_os = "windows")'.dependencies]
26+
winapi = { version = "0.3.9", features = ["winioctl", "fileapi", "winnt", "handleapi", "errhandlingapi"] }
2727
windows = { version = "0.58", features = [
2828
"Win32_Foundation",
2929
"Win32_Storage_FileSystem",
@@ -34,5 +34,7 @@ windows = { version = "0.58", features = [
3434
widestring = "1"
3535

3636
[target.'cfg(target_os = "linux")'.dependencies]
37+
libc = "0.2"
3738

3839
[target.'cfg(target_os = "macos")'.dependencies]
40+
libc = "0.2"

src-tauri/src/commands.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ fn check_admin_status() -> bool {
6666
.unwrap_or(false)
6767
}
6868

69-
#[cfg(not(target_os = "windows"))]
69+
#[cfg(target_os = "linux")]
70+
fn check_admin_status() -> bool {
71+
unsafe { libc::geteuid() == 0 }
72+
}
73+
74+
#[cfg(target_os = "macos")]
7075
fn check_admin_status() -> bool {
7176
unsafe { libc::geteuid() == 0 }
7277
}

src-tauri/src/usb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub fn list_usb_devices() -> Result<Vec<UsbDevice>, String> {
181181
.output()
182182
.map_err(|e| format!("Failed to run diskutil: {}", e))?;
183183

184-
let stdout = String::from_utf8_lossy(&output.stdout);
184+
let _stdout = String::from_utf8_lossy(&output.stdout);
185185
let mut devices = Vec::new();
186186

187187
// Parse plist output - look for disk identifiers

src-tauri/src/windows_iso.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::writer::{FlashOptions, FlashProgress, FlashResult};
2+
#[cfg(target_os = "windows")]
23
use std::process::{Command, Stdio};
3-
use std::fs::OpenOptions;
4-
use std::io::Write;
54
use std::sync::atomic::{AtomicBool, Ordering};
65
use std::time::Instant;
76
use tauri::AppHandle;
@@ -323,6 +322,7 @@ fn format_usb_drive(disk_number: u32, options: &FlashOptions) -> Result<(String,
323322

324323
#[cfg(target_os = "windows")]
325324
fn write_uefi_ntfs(fat_letter: &str) -> Result<(), String> {
325+
use std::io::Write;
326326
use std::os::windows::io::FromRawHandle;
327327
use windows::Win32::System::Ioctl::{FSCTL_LOCK_VOLUME, FSCTL_DISMOUNT_VOLUME, FSCTL_UNLOCK_VOLUME};
328328
use windows::Win32::System::IO::DeviceIoControl;
@@ -491,7 +491,7 @@ fn copy_files_robocopy(app: &AppHandle, source: &str, dest: &str, total_bytes: u
491491
} else {
492492
// It might be a new file line. Format with /BYTES: Status | Size | Path
493493
let parts: Vec<&str> = trimmed.split_whitespace().collect();
494-
for (i, part) in parts.iter().enumerate() {
494+
for (_i, part) in parts.iter().enumerate() {
495495
if let Ok(size) = part.parse::<u64>() {
496496
// A new file has started. If we missed the 100% of the previous one,
497497
// add it to finished files now just in case.

0 commit comments

Comments
 (0)