pub struct CreateFileOptions {Show 20 fields
pub mode: Option<u32>,
pub uid: Option<u32>,
pub gid: Option<u32>,
pub type_code: Option<String>,
pub creator_code: Option<String>,
pub os_type: Option<[u8; 4]>,
pub os_creator: Option<[u8; 4]>,
pub finder_flags: Option<u16>,
pub aux_type: Option<u16>,
pub resource_fork: Option<ResourceForkSource>,
pub xattrs: Vec<Xattr>,
pub amiga_protection: Option<u32>,
pub amiga_comment: Option<String>,
pub amiga_dates: Option<(i32, i32, i32)>,
pub skip_data_write: bool,
pub skip_name_checks: bool,
pub skip_fsinfo_update: bool,
pub dos_attributes: Option<u16>,
pub unix_times: Option<UnixTimes>,
pub qnx2_attrs: Option<Qnx2Attrs>,
}Expand description
Options for creating a file on an editable filesystem.
Fields§
§mode: Option<u32>Unix mode bits (default 0o100666). Ignored on FAT/exFAT.
uid: Option<u32>Unix user ID (default 0). Ignored on FAT/exFAT/NTFS.
gid: Option<u32>Unix group ID (default 0). Ignored on FAT/exFAT/NTFS.
type_code: Option<String>HFS/HFS+ type code (e.g. “TEXT”) or ProDOS type as “$XX” (e.g. “$04”).
Auto-detected from extension if not set. This is the caller-typed text
form; for byte-exact Mac type/creator preservation (high-bit OSTypes)
use os_type instead.
creator_code: Option<String>HFS/HFS+ creator code (e.g. “MSWD”). Auto-detected from extension if not set.
os_type: Option<[u8; 4]>Raw 4-byte Mac OSType file type. When set, HFS/HFS+/MFS create_file
writes these bytes into the Finder info verbatim, taking precedence over
the lossy type_code text. Used by fidelity-preserving copies
(cp, get-binhex, archive replay) so a high-bit creator like Prince
of Persia’s PoƒP (0xC4) survives. None outside the Mac family.
os_creator: Option<[u8; 4]>Raw 4-byte Mac OSType creator. See os_type.
finder_flags: Option<u16>Finder flags (fdFlags) for HFS/HFS+: bundle bit, custom icon, invisible.
None leaves them zero, as a freshly created file has them.
aux_type: Option<u16>ProDOS auxiliary type (16-bit). Semantics depend on the file type: $0801 for Applesoft BASIC load address, $2000 for typical BIN, record length for random-access TXT, etc. Auto-detected from extension if not set. Ignored on non-ProDOS filesystems.
resource_fork: Option<ResourceForkSource>Optional resource fork data source (HFS/HFS+ only).
xattrs: Vec<Xattr>Extended attributes to stamp on the new file, on filesystems that store them. Ignored elsewhere.
Exists mainly so an overwrite can keep them. Replacing a file is
delete-then-create, and the create otherwise knows nothing about what it
displaced — so a binary carrying security.capability came back without
it and silently stopped working. Mode and ownership already survive a
replace via [crate::fs::attrs::resolve_attrs]; this is the same rule
for the attributes that don’t live in the inode. See
[crate::fs::attrs::inherited_xattrs].
amiga_protection: Option<u32>AmigaDOS protection bits (access word) for AFFS/FFS. The
on-disk default of 0 displays as ----rwed. Ignored on
non-Amiga filesystems.
amiga_comment: Option<String>AmigaDOS filenote (comment, up to 79 bytes). Ignored on non-Amiga filesystems.
amiga_dates: Option<(i32, i32, i32)>AmigaDOS raw datestamp triple (days, minutes, ticks) since
1978-01-01. When set, written verbatim into the on-disk entry so
dates round-trip through clone/restore. Ignored on non-Amiga
filesystems. Default None leaves the date zero (which display
tools render as the epoch).
skip_data_write: boolWhen true, allocate clusters and create the directory entry but skip writing file content. The allocated clusters are left uninitialized (zero on fresh images). Used by the GHO file-aware virtual-FAT builder to avoid writing 1 GB+ of zeros that are immediately evicted.
skip_name_checks: boolWhen true, skip the duplicate-name check and SFN collision scan before creating the file. The caller guarantees uniqueness (e.g. entries come from a pre-deduplicated tree on a fresh FS). Eliminates the O(n) parent-directory read per file.
skip_fsinfo_update: boolWhen true, skip the per-operation FSInfo update (FAT32).
Caller must call sync_metadata when done to write a correct
FSInfo sector. Eliminates two full FAT-table reads per file.
dos_attributes: Option<u16>Standard DOS attribute bits to stamp on the new file (read-only
0x01, hidden 0x02, system 0x04, archive 0x20). Honored by
FAT and exFAT; ignored elsewhere. None lets the filesystem pick
its conventional default (FAT/exFAT use archive). See
[crate::fs::entry::FileEntry::dos_attributes].
unix_times: Option<UnixTimes>Preserve these Unix timestamps (seconds since 1970) on the new
inode instead of stamping the current time. Set by dir_import /
tar_import / Commander stage_copy so a copy carries the
source’s mtime through end-to-end; left None for a genuinely new
file (rb-cli put from a - stdin stream, GUI “new blank file”),
where the driver stamps now. Ignored on filesystems that don’t
carry per-file Unix times (FAT/exFAT/NTFS have their own scheme,
AmigaDOS uses amiga_dates, HFS uses mac_dates). See
[crate::fs::times::UnixTimes].
qnx2_attrs: Option<Qnx2Attrs>QNX 2 permissions, owner and date copied exactly (from FileEntry::qnx2_attrs); overrides mode / uid / gid / unix_times.