extern type WinFindDataA = { dwFileAttributes: u32, ftCreationLow: u32, ftCreationHigh: u32, ftLastAccessLow: u32, ftLastAccessHigh: u32, ftLastWriteLow: u32, ftLastWriteHigh: u32, nFileSizeHigh: u32, nFileSizeLow: u32, dwReserved0: u32, dwReserved1: u32, cFileName: [260]u8, cAlternateFileName: [14]u8 }
Fields
| Name | Type |
|---|
dwFileAttributes | u32 |
ftCreationLow | u32 |
ftCreationHigh | u32 |
ftLastAccessLow | u32 |
ftLastAccessHigh | u32 |
ftLastWriteLow | u32 |
ftLastWriteHigh | u32 |
nFileSizeHigh | u32 |
nFileSizeLow | u32 |
dwReserved0 | u32 |
dwReserved1 | u32 |
cFileName | [260]u8 |
cAlternateFileName | [14]u8 |
extern (C, header) fn CreateDirectoryA(path: ref u8, security: ref void) i32 = trust { ... } = "CreateDirectoryA"
extern (C, header) fn FindFirstFileA(pattern: ref u8, data: ref WinFindDataA) ref void = trust { ... } = "FindFirstFileA"
extern (C, header) fn FindNextFileA(handle: ref void, data: ref WinFindDataA) i32 = trust { ... } = "FindNextFileA"
extern (C, header) fn FindClose(handle: ref void) i32 = trust { ... } = "FindClose"
extern (C, header) fn CopyFileA(existing: ref u8, new_file: ref u8, fail_if_exists: i32) i32 = trust { ... } = "CopyFileA"
extern (C, header) fn GetFileAttributesA(path: ref u8) u32 = trust { ... } = "GetFileAttributesA"
extern type Dirent = { d_ino: u64, d_off: i64, d_reclen: u16, d_type: u8, d_name: [256]u8 }
Fields
| Name | Type |
|---|
d_ino | u64 |
d_off | i64 |
d_reclen | u16 |
d_type | u8 |
d_name | [256]u8 |
extern type Dirent = { d_ino: u64, d_seekoff: u64, d_reclen: u16, d_namlen: u16, d_type: u8, d_name: [1024]u8 }
Fields
| Name | Type |
|---|
d_ino | u64 |
d_seekoff | u64 |
d_reclen | u16 |
d_namlen | u16 |
d_type | u8 |
d_name | [1024]u8 |
extern type Dirent = { d_fileno: u64, d_off: i64, d_reclen: u16, d_type: u8, d_pad0: u8, d_namlen: u16, d_pad1: u16, d_name: [256]u8 }
Fields
| Name | Type |
|---|
d_fileno | u64 |
d_off | i64 |
d_reclen | u16 |
d_type | u8 |
d_pad0 | u8 |
d_namlen | u16 |
d_pad1 | u16 |
d_name | [256]u8 |
extern type Dirent = { d_fileno: u64, d_off: i64, d_reclen: u16, d_type: u8, d_namlen: u8, d_name: [256]u8 }
Fields
| Name | Type |
|---|
d_fileno | u64 |
d_off | i64 |
d_reclen | u16 |
d_type | u8 |
d_namlen | u8 |
d_name | [256]u8 |
extern type Dirent = { d_fileno: u64, d_reclen: u16, d_namlen: u16, d_type: u8, d_name: [512]u8 }
Fields
| Name | Type |
|---|
d_fileno | u64 |
d_reclen | u16 |
d_namlen | u16 |
d_type | u8 |
d_name | [512]u8 |
extern type Dirent = { d_ino: i32, d_reclen: u16, d_namlen: u16, d_name: [260]u8 }
Fields
| Name | Type |
|---|
d_ino | i32 |
d_reclen | u16 |
d_namlen | u16 |
d_name | [260]u8 |
pub fn getenv(name: ref u8) ref u8 = trust { ... }
pub fn mkdir(path: ref u8, mode: u32) i32 = trust { ... }
pub fn rmdir(path: ref u8) i32 = trust { ... }
pub fn opendir(path: ref u8) ref void = trust { ... }
pub fn closedir(dir: ref void) i32 = trust { ... }
pub fn readdir(dir: ref void) ref Dirent = trust { ... }
pub fn exit(code: i64) void = trust { ... }
fn fopen(path: ref u8, mode: ref u8) ref void = trust { ... }
fn fclose(file: ref void) i32 = trust { ... }
fn fread(ptr: ref void, size: i64, nmemb: i64, file: ref void) i64 = trust { ... }
fn fwrite(ptr: ref void, size: i64, nmemb: i64, file: ref void) i64 = trust { ... }
fn remove(path: ref u8) i32 = trust { ... }
fn rename(oldpath: ref u8, newpath: ref u8) i32 = trust { ... }
fn access(path: ref u8, mode: i32) i32 = trust { ... }
fn popen(cmd: ref u8, mode: ref u8) ref void = trust { ... }
fn pclose(pipe: ref void) i32 = trust { ... }
fn system(cmd: ref u8) i32 = trust { ... }
pub enum ProcessError = { FailedToStart, ReadFailed }
Variants
pub fn env(var: ref u8) option[ref u8]
Get an environment variable. Returns none if not found.
pub fn exists(path: ref u8) bool
Check if a file exists at the given path.
pub fn open(path: ref u8, mode: ref u8) option[ref void]
Open a file in the given mode ("r", "w", "a", etc.). Returns the file handle or none.
pub fn close(file: ref void) void = trust { ... }
pub fn read(file: ref void, size: i64) ref void = trust { ... }
Read up to size bytes from a file. Returns a heap buffer.
pub fn write(file: ref void, buf: ref void, size: i64) i64 = trust { ... }
Write size bytes from a buffer to a file.
pub fn delete(path: ref u8) i32 = trust { ... }
Delete a file from the filesystem. Returns 0 on success.
pub fn rename_file(oldpath: ref u8, newpath: ref u8) i32 = trust { ... }
Rename a file. Returns 0 on success.
fn is_dot_dir_entry(name: ref u8) bool
fn ensure_dir(path: ref u8) bool = trust { ... }
pub fn copy_file(src_path: ref u8, dst_path: ref u8) bool = trust { ... }
Copy one file to another path.
pub fn copy_dir_recursive(src_dir: ref u8, dst_dir: ref u8) bool = trust { ... }
Recursively copy a directory tree.
fn bytes_equal(buf: ref void, expected: ref u8, len: i64) bool
pub fn get_args() list[ref u8] = trust { ... }
Get command-line arguments as a List of strings.
fn command_for_shell(cmd: ref u8) ref u8 = trust { ... }
Quote a command that starts with a quoted executable.
This is a no-op outside of Windows.
pub fn run(cmd: ref u8) i32 = trust { ... }
Execute a command inheriting stdout/stderr (no capture). Returns exit code.
pub fn exec(cmd: ref u8) result[String, ProcessError] = trust { ... }
Execute some subprocess, capturing its output.
fn path_separator() u8 = trust { ... }
pub fn in_path(binary: ref u8) bool = trust { ... }
Check if a binary is available in PATH.
pub fn exec_trim(cmd: ref u8) result[ref void, ProcessError] = trust { ... }