Skip to content

Commit

Permalink
⚡ Support redox as tier3 target
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Sep 9, 2024
1 parent d64f87a commit 22b4db7
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cli/src/utils/os.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#[cfg(target_os = "redox")]
mod redox {
pub(crate) mod fs {
pub(crate) mod owner;
}
}
#[cfg(unix)]
pub(crate) mod unix;
#[cfg(windows)]
Expand Down
47 changes: 47 additions & 0 deletions cli/src/utils/os/redox/fs/owner.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
use nix::unistd::{Gid, Uid};

pub(crate) struct User(Uid);
impl User {
#[inline]
pub(crate) fn from_uid(uid: Uid) -> Option<Self> {
Some(Self(uid))
}

#[inline]
pub(crate) fn from_name(_name: &str) -> Option<Self> {
None
}

#[inline]
pub(crate) fn name(&self) -> &str {
""
}

#[inline]
pub(crate) fn as_raw(&self) -> u32 {
self.0.as_raw()
}
}
pub(crate) struct Group(Gid);

impl Group {
#[inline]
pub(crate) fn from_gid(gid: Gid) -> Option<Self> {
Some(Self(gid))
}

#[inline]
pub(crate) fn from_name(_name: &str) -> Option<Self> {
None
}

#[inline]
pub(crate) fn name(&self) -> &str {
""
}

#[inline]
pub(crate) fn as_raw(&self) -> u32 {
self.0.as_raw()
}
}
3 changes: 3 additions & 0 deletions cli/src/utils/os/unix/fs.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
#[cfg(not(target_os = "redox"))]
pub(crate) mod owner;
#[cfg(target_os = "redox")]
pub(crate) use crate::utils::os::redox::fs::owner;
pub(crate) mod xattrs;

0 comments on commit 22b4db7

Please sign in to comment.