diff --git a/yazi-plugin/src/utils/user.rs b/yazi-plugin/src/utils/user.rs index cc64319b..7f452ed1 100644 --- a/yazi-plugin/src/utils/user.rs +++ b/yazi-plugin/src/utils/user.rs @@ -1,14 +1,16 @@ use mlua::{Lua, Table}; -use uzers::{Groups, Users, UsersCache}; use yazi_shared::RoCell; use super::Utils; -static CACHE: RoCell = RoCell::new(); - impl Utils { #[cfg(unix)] pub(super) fn user(lua: &Lua, ya: &Table) -> mlua::Result<()> { + #[cfg(unix)] + use uzers::{Groups, Users, UsersCache}; + #[cfg(unix)] + static CACHE: RoCell = RoCell::new(); + CACHE.with(Default::default); ya.set("uid", lua.create_function(|_, ()| Ok(CACHE.get_current_uid()))?)?;