Only use uzers on unix, do not fork on mac

This commit is contained in:
Jeremy Soller 2026-04-17 12:48:39 -06:00
parent 62bfcc3550
commit 8c57060db2
3 changed files with 8 additions and 7 deletions

View file

@ -55,7 +55,6 @@ rust-embed = "8"
slotmap = "1.1.1" slotmap = "1.1.1"
recently-used-xbel = "1.2.0" recently-used-xbel = "1.2.0"
zip = "8" zip = "8"
uzers = "0.12.2"
md-5 = "0.10.6" md-5 = "0.10.6"
png = "0.18" png = "0.18"
jxl-oxide = { version = "0.12.5", features = ["image"] } jxl-oxide = { version = "0.12.5", features = ["image"] }
@ -130,6 +129,7 @@ debug = true
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
fork = "0.7" fork = "0.7"
uzers = "0.12.2"
[target.'cfg(target_os = "linux")'.dependencies] [target.'cfg(target_os = "linux")'.dependencies]
procfs = "0.18" procfs = "0.18"

View file

@ -191,7 +191,7 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
} }
if daemonize { if daemonize {
#[cfg(all(unix, not(target_os = "redox")))] #[cfg(all(unix, not(any(target_os = "macos", target_os = "redox"))))]
match fork::daemon(true, true) { match fork::daemon(true, true) {
Ok(fork::Fork::Child) => (), Ok(fork::Fork::Child) => (),
Ok(fork::Fork::Parent(_child_pid)) => process::exit(0), Ok(fork::Fork::Parent(_child_pid)) => process::exit(0),

View file

@ -85,7 +85,6 @@ use crate::{
thumbnailer::thumbnailer, thumbnailer::thumbnailer,
trash::{Trash, TrashExt}, trash::{Trash, TrashExt},
}; };
use uzers::{get_group_by_gid, get_user_by_uid};
pub const DOUBLE_CLICK_DURATION: Duration = Duration::from_millis(500); pub const DOUBLE_CLICK_DURATION: Duration = Duration::from_millis(500);
pub const HOVER_DURATION: Duration = Duration::from_millis(1600); pub const HOVER_DURATION: Duration = Duration::from_millis(1600);
@ -2429,7 +2428,7 @@ impl Item {
let mode = metadata.mode(); let mode = metadata.mode();
let user_name = get_user_by_uid(metadata.uid()) let user_name = uzers::get_user_by_uid(metadata.uid())
.and_then(|user| user.name().to_str().map(ToOwned::to_owned)) .and_then(|user| user.name().to_str().map(ToOwned::to_owned))
.unwrap_or_default(); .unwrap_or_default();
let user_path = path.clone(); let user_path = path.clone();
@ -2452,7 +2451,7 @@ impl Item {
)), )),
); );
let group_name = get_group_by_gid(metadata.gid()) let group_name = uzers::get_group_by_gid(metadata.gid())
.and_then(|group| group.name().to_str().map(ToOwned::to_owned)) .and_then(|group| group.name().to_str().map(ToOwned::to_owned))
.unwrap_or_default(); .unwrap_or_default();
let group_path = path.clone(); let group_path = path.clone();
@ -6358,14 +6357,16 @@ impl Tab {
total_size = total_size.saturating_add(metadata.len()); total_size = total_size.saturating_add(metadata.len());
} }
let mode = metadata.mode(); let mode = metadata.mode();
#[cfg(unix)]
user_name.insert( user_name.insert(
get_user_by_uid(metadata.uid()) uzers::get_user_by_uid(metadata.uid())
.and_then(|user| user.name().to_str().map(ToOwned::to_owned)) .and_then(|user| user.name().to_str().map(ToOwned::to_owned))
.unwrap_or_default(), .unwrap_or_default(),
); );
mode_user.insert(get_mode_part(mode, MODE_SHIFT_USER)); mode_user.insert(get_mode_part(mode, MODE_SHIFT_USER));
#[cfg(unix)]
group_name.insert( group_name.insert(
get_group_by_gid(metadata.gid()) uzers::get_group_by_gid(metadata.gid())
.and_then(|group| group.name().to_str().map(ToOwned::to_owned)) .and_then(|group| group.name().to_str().map(ToOwned::to_owned))
.unwrap_or_default(), .unwrap_or_default(),
); );