Skip to content

Commit 3bb62c2

Browse files
committed
Fix Windows build compatibility
- Add conditional compilation for Unix-specific permissions - Use cfg! macro for cross-platform permission formatting - Resolves Windows build failure with Unix-only imports
1 parent 0401735 commit 3bb62c2

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

Cargo.lock

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

src/app.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use sysinfo::{System, Disks, Networks};
99
use std::time::Instant;
1010
use std::fs;
1111
use std::path::PathBuf;
12+
#[cfg(unix)]
1213
use std::os::unix::fs::PermissionsExt;
1314
use tracing::{error, warn, info};
1415

@@ -727,7 +728,18 @@ impl App {
727728
if let Ok(metadata) = std::fs::metadata(selected_path) {
728729
let file_size = metadata.len();
729730
let is_dir = metadata.is_dir();
730-
let permissions = format!("{:o}", metadata.permissions().mode() & 0o777);
731+
let permissions = if cfg!(unix) {
732+
#[cfg(unix)]
733+
{
734+
format!("{:o}", metadata.permissions().mode() & 0o777)
735+
}
736+
#[cfg(not(unix))]
737+
{
738+
"N/A".to_string()
739+
}
740+
} else {
741+
"N/A".to_string()
742+
};
731743

732744
// Get file name without emoji prefix
733745
let clean_name = selected_item

0 commit comments

Comments
 (0)