Skip to main content

FileEntry

Struct FileEntry 

Source
pub struct FileEntry {
Show 27 fields pub name: String, pub path: String, pub entry_type: EntryType, pub size: u64, pub location: u64, pub modified: Option<String>, pub modified_unix: Option<u64>, pub type_code: Option<[u8; 4]>, pub creator_code: Option<[u8; 4]>, pub finder_flags: Option<u16>, pub symlink_target: Option<String>, pub special_type: Option<String>, pub mode: Option<u32>, pub uid: Option<u32>, pub gid: Option<u32>, pub resource_fork_size: Option<u64>, pub aux_type: Option<u16>, pub prodos_file_type: Option<u8>, pub link_target_cnid: Option<u64>, pub amiga_protection: Option<u32>, pub amiga_comment: Option<String>, pub amiga_date: Option<(i32, i32, i32)>, pub dos_attributes: Option<u16>, pub mac_dates: Option<(u32, u32, u32)>, pub owner_label: Option<String>, pub native_attrs: Option<String>, pub qnx2_attrs: Option<Qnx2Attrs>,
}
Expand description

A file or directory entry within a partition’s filesystem.

Fields§

§name: String§path: String§entry_type: EntryType§size: u64§location: u64

Starting cluster (FAT) or inode/extent for other filesystems.

§modified: Option<String>

Human-readable modification date string.

§modified_unix: Option<u64>

Modification time in seconds since UNIX epoch 1970-01-01. The numeric twin of modified — the display string is for the browser/ls, this is what tar_export writes into its headers and what a stage_copy passes into CreateFileOptions.unix_times so a cross-image copy preserves the source’s date instead of stamping the current time. Populated by every filesystem driver whose on-disk format carries a per-file mtime (all Unix / Amiga / classic-Mac / DOS families); None on formats that don’t (Apple DOS 3.3, TRS-80, etc.).

§type_code: Option<[u8; 4]>

HFS/HFS+/MFS file type as the raw 4-byte Mac OSType, exactly as stored on disk (e.g. *b"APPL", *b"PICT"). Kept as bytes — not text — because an OSType may hold non-ASCII bytes (e.g. Prince of Persia’s PoƒP creator has 0xC4), and round-trip writers (get-binhex, cp, tar, archives) must preserve them verbatim. For display, render via [FileEntry::type_code_display] (lossy) — never rebuild bytes from it. None on non-Mac filesystems (ProDOS uses [prodos_file_type]).

§creator_code: Option<[u8; 4]>

HFS/HFS+/MFS creator as the raw 4-byte Mac OSType. See type_code; display via creator_code_display.

§finder_flags: Option<u16>

HFS/HFS+/MFS Finder flags (FInfo.fdFlags): hasBundle (0x2000), hasCustomIcon (0x0400), isInvisible (0x4000), nameLocked, isStationery, the kIsAlias bit (0x8000), etc. The 2-byte field at offset 8 of the 16-byte Finder info. None on non-Mac filesystems. Carried so copy / get-binhex round-trips preserve a file’s real icon (a dropped hasBundle makes an app and its documents show generic icons). See docs/bug_binhex_finder_flags.md.

§symlink_target: Option<String>

Symlink target path (only set for EntryType::Symlink).

§special_type: Option<String>

Special file type description (e.g. “block device”, “char device”, “socket”, “fifo”). Only set for EntryType::Special.

§mode: Option<u32>

Raw Unix mode bits (e.g. 0o100755). Present on ext/btrfs/xfs/UFS filesystems.

§uid: Option<u32>

Unix user ID. Present on ext/btrfs/xfs/UFS filesystems.

§gid: Option<u32>

Unix group ID. Present on ext/btrfs/xfs/UFS filesystems.

§resource_fork_size: Option<u64>

Resource fork size (HFS/HFS+ only). None or Some(0) means no resource fork.

§aux_type: Option<u16>

ProDOS auxiliary type (16-bit). Semantics depend on the file type (e.g. $0801 = Applesoft BASIC load address, load addr for BIN, record length for random-access TXT). Only set for ProDOS entries.

§prodos_file_type: Option<u8>

ProDOS file type — the raw 1-byte type value (e.g. $04 = TXT, $06 = BIN, $FF = SYS). ProDOS has no Mac OSType, so it uses this instead of type_code. Rendered for display by type_code_display via prodos_types::format_type_code. Only set for ProDOS entries.

§link_target_cnid: Option<u64>

HFS+ hardlink target inode CNID. Set on entries whose catalog row is a hardlink stub (fdType='hlnk' fdCreator='hfs+'); the link’s data and resource forks live on the inode at this CNID under HFS+ Private Data. read_file / write_file_to follow the indirection automatically. None for ordinary files.

§amiga_protection: Option<u32>

AmigaDOS protection word (access field of an AFFS file header). 0 displays as ----rwed. Only set for AmigaDOS / Fast File System entries.

§amiga_comment: Option<String>

AmigaDOS filenote (comment), up to 79 bytes. Only set for AmigaDOS / Fast File System entries; None outside that family.

§amiga_date: Option<(i32, i32, i32)>

AmigaDOS raw datestamp triple (days, minutes, ticks) from the on-disk entry. Days since 1978-01-01, minutes within the day, and ticks (1/50s) within the minute. Preserved verbatim for byte-exact round-trips through clone/restore. AFFS stores these as i32 on disk; PFS3 direntries narrow them to u16 — we widen to i32 so both round-trip losslessly. The display string lives in modified. Only set for AmigaDOS / PFS3 / SFS entries; None outside that family.

§dos_attributes: Option<u16>

Standard DOS attribute bits (read-only 0x01, hidden 0x02, system 0x04, archive 0x20; the volume-label 0x08 and directory 0x10 bits are represented by entry_type and not carried here). Populated for FAT (the on-disk u8 widened) and exFAT (the directory entry’s u16 FileAttributes). None for filesystems that have no DOS attribute concept. The copy engine carries this across FAT/exFAT destinations.

§mac_dates: Option<(u32, u32, u32)>

HFS/HFS+/MFS raw catalog dates (create, modify, backup) in Mac-epoch seconds (since 1904-01-01 UTC). Kept raw so the detail pane can both display them (via hfs_common::format_mac_date) and stage an in-place edit (StagedEdit::SetDates). The modify value is also surfaced as a formatted string in modified. None outside the HFS family.

§owner_label: Option<String>

Owner in the filesystem’s own notation (QNX 2 group.member); shown instead of uid:gid.

§native_attrs: Option<String>

Native attribute/permission letters for formats whose bits do not map onto a Unix mode.

§qnx2_attrs: Option<Qnx2Attrs>

QNX 2 permissions, owner and raw date words, so QNX 2 to QNX 2 copies keep them exactly.

Implementations§

Source§

impl FileEntry

Source

pub fn root() -> Self

Source

pub fn new_directory(name: String, path: String, location: u64) -> Self

Source

pub fn new_file(name: String, path: String, size: u64, location: u64) -> Self

Source

pub fn new_special( name: String, path: String, location: u64, special_type_str: String, ) -> Self

Source

pub fn archive_name(&self) -> Option<&str>

The name this entry should carry inside an archive or an extraction folder — or None when it is a volume root, which contributes its children rather than a member of its own.

Every driver names the volume root "/" (the optical drivers map their empty root name onto it too), and that is not a usable member name: tar and zip both reject absolute paths, and Path::join("/") silently throws away the destination directory and hands back the host root. So an exporter handed a whole volume must ask here rather than reach for name — the answer is “this has no name, recurse into it at the same level”, which is also what tar -C / . does.

Source

pub fn is_directory(&self) -> bool

Source

pub fn is_file(&self) -> bool

Source

pub fn is_special(&self) -> bool

Source

pub fn mode_string(&self) -> Option<String>

Returns a human-readable Unix permission string (e.g. “drwxr-xr-x”), or None if mode bits are not available (non-Unix filesystems).

Source

pub fn size_string(&self) -> String

Source

pub fn creator_code_display(&self) -> Option<String>

Human-readable creator string for display. Mac OSType only (ProDOS has no creator), rendered lossily by crate::display::decode_ostype.

Trait Implementations§

Source§

impl Clone for FileEntry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.