Dir
Source: std/dir.mw.
Directories and file metadata (Linux today; other platforms report failure).
Constants
Section titled “Constants”| Name | Type | Value | Notes |
|---|---|---|---|
DIR_KIND_OTHER |
i64 |
0 |
|
DIR_KIND_FILE |
i64 |
1 |
|
DIR_KIND_DIR |
i64 |
2 |
|
DIR_KIND_LINK |
i64 |
3 |
DirEntry
Section titled “DirEntry”struct DirEntry { name: *u8; kind: i64;}Functions
Section titled “Functions”dir_entry_free
Section titled “dir_entry_free”fn dir_entry_free(e: *DirEntry)dir_list_free
Section titled “dir_list_free”fn dir_list_free(v: *VecPtr)Frees the list returned by dir_list.
dir_list
Section titled “dir_list”fn dir_list(path: *u8) -> *VecPtrEntries of a directory (without “.” and “..”), sorted by name. null on error.
file_stat
Section titled “file_stat”fn file_stat(path: *u8, mode: *i64, size: *i64, mtime: *i64) -> boolMode, size and modification time (Unix seconds) of a path. false if it does not exist or stat is unavailable.
path_is_dir
Section titled “path_is_dir”fn path_is_dir(path: *u8) -> boolpath_is_file
Section titled “path_is_file”fn path_is_file(path: *u8) -> boolpath_size
Section titled “path_size”fn path_size(path: *u8) -> i64Size in bytes, or -1.
path_mtime
Section titled “path_mtime”fn path_mtime(path: *u8) -> i64Modification time in Unix seconds, or -1.
file_rename
Section titled “file_rename”fn file_rename(from: *u8, to: *u8) -> booldir_remove
Section titled “dir_remove”fn dir_remove(path: *u8) -> boolRemoves an empty directory.
dir_create_all
Section titled “dir_create_all”fn dir_create_all(path: *u8) -> boolCreates a directory and any missing parents (like mkdir -p).
remove_all
Section titled “remove_all”fn remove_all(path: *u8) -> boolRemoves a file or a directory tree (symbolic links are removed, not followed).
cwd_get
Section titled “cwd_get”fn cwd_get() -> *u8Current working directory as a new string, or null.
cwd_set
Section titled “cwd_set”fn cwd_set(path: *u8) -> bool