Functions
fn accessAbsolute(absolute_path: []const u8, flags: File.OpenFlags) Dir.AccessError!void
Test accessing
path
.path
is UTF-8-encoded. Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function. For example, instead of testing if a file exists and then opening it, just open it and handle the error for file not found. SeeaccessAbsoluteZ
for a function that accepts a null-terminated path.fn accessAbsoluteW(absolute_path: [*:0]const 16, flags: File.OpenFlags) Dir.AccessError!void
Same as
accessAbsolute
but the path parameter is WTF-16 encoded.fn accessAbsoluteZ(absolute_path: [*:0]const u8, flags: File.OpenFlags) Dir.AccessError!void
Same as
accessAbsolute
but the path parameter is null-terminated.fn atomicSymLink(allocator: Allocator, existing_path: []const u8, new_path: []const u8) !void
TODO remove the allocator requirement from this API
fn copyFileAbsolute(source_path: []const u8, dest_path: []const u8, args: CopyFileOptions) !void
Same as
Dir.copyFile
, except asserts that bothsource_path
anddest_path
…Same as
Dir.copyFile
, except asserts that bothsource_path
anddest_path
are absolute. SeeDir.copyFile
for a function that operates on both absolute and relative paths.fn createFileAbsolute(absolute_path: []const u8, flags: File.CreateFlags) File.OpenError!File
Creates, opens, or overwrites a file with write access, based on an absolute pat…
Creates, opens, or overwrites a file with write access, based on an absolute path. Call
File.close
to release the resource. Asserts that the path is absolute. SeeDir.createFile
for a function that operates on both absolute and relative paths. Asserts that the path parameter has no null bytes. SeecreateFileAbsoluteC
for a function that accepts a null-terminated path.fn createFileAbsoluteW(absolute_path_w: [*:0]const u16, flags: File.CreateFlags) File.OpenError!File
Same as
createFileAbsolute
but the path parameter is WTF-16 encoded.fn createFileAbsoluteZ(absolute_path_c: [*:0]const u8, flags: File.CreateFlags) File.OpenError!File
Same as
createFileAbsolute
but the path parameter is null-terminated.fn cwd() Dir
Returns a handle to the current working directory. It is not opened with iterati…
Returns a handle to the current working directory. It is not opened with iteration capability. Closing the returned
Dir
is checked illegal behavior. Iterating over the result is illegal behavior. On POSIX targets, this function is comptime-callable.fn deleteDirAbsoluteW(dir_path: [*:0]const u16) !void
Same as
deleteDirAbsolute
except the path parameter is WTF-16 and target OS is…Same as
deleteDirAbsolute
except the path parameter is WTF-16 and target OS is assumed Windows.fn deleteDirAbsoluteZ(dir_path: [*:0]const u8) !void
Same as
deleteDirAbsolute
except the path parameter is null-terminated.fn deleteFileAbsolute(absolute_path: []const u8) Dir.DeleteFileError!void
Delete a file name and possibly the file it refers to, based on an absolute path…
Delete a file name and possibly the file it refers to, based on an absolute path. Asserts that the path is absolute. See
Dir.deleteFile
for a function that operates on both absolute and relative paths. Asserts that the path parameter has no null bytes.fn deleteFileAbsoluteW(absolute_path_w: [*:0]const u16) Dir.DeleteFileError!void
Same as
deleteFileAbsolute
except the parameter is WTF-16 encoded.fn deleteFileAbsoluteZ(absolute_path_c: [*:0]const u8) Dir.DeleteFileError!void
Same as
deleteFileAbsolute
except the parameter is null-terminated.fn deleteTreeAbsolute(absolute_path: []const u8) !void
Removes a symlink, file, or directory. This is equivalent to
Dir.deleteTree
w…Removes a symlink, file, or directory. This is equivalent to
Dir.deleteTree
with the base directory. Asserts that the path is absolute. SeeDir.deleteTree
for a function that operates on both absolute and relative paths. Asserts that the path parameter has no null bytes.fn getAppDataDir(allocator: mem.Allocator, appname: []const u8) GetAppDataDirError![]u8
No documentation provided.
fn makeDirAbsolute(absolute_path: []const u8) !void
Create a new directory, based on an absolute path. Asserts that the path is abs…
Create a new directory, based on an absolute path. Asserts that the path is absolute. See
Dir.makeDir
for a function that operates on both absolute and relative paths.fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void
Same as
makeDirAbsolute
except the parameter is a null-terminated WTF-16-encod…Same as
makeDirAbsolute
except the parameter is a null-terminated WTF-16-encoded string.fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void
Same as
makeDirAbsolute
except the parameter is a null-terminated UTF-8-encode…Same as
makeDirAbsolute
except the parameter is a null-terminated UTF-8-encoded string.fn openDirAbsolute(absolute_path: []const u8, flags: Dir.OpenDirOptions) File.OpenError!Dir
Opens a directory at the given path. The directory is a system resource that rem…
Opens a directory at the given path. The directory is a system resource that remains open until
close
is called on the result. SeeopenDirAbsoluteZ
for a function that accepts a null-terminated path.Asserts that the path parameter has no null bytes.
fn openDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenDirOptions) File.OpenError!Dir
Same as
openDirAbsolute
but the path parameter is null-terminated.fn openDirAbsoluteZ(absolute_path_c: [*:0]const u8, flags: Dir.OpenDirOptions) File.OpenError!Dir
Same as
openDirAbsolute
but the path parameter is null-terminated.fn openFileAbsolute(absolute_path: []const u8, flags: File.OpenFlags) File.OpenError!File
Opens a file for reading or writing, without attempting to create a new file, ba…
Opens a file for reading or writing, without attempting to create a new file, based on an absolute path. Call
File.close
to release the resource. Asserts that the path is absolute. SeeDir.openFile
for a function that operates on both absolute and relative paths. Asserts that the path parameter has no null bytes. SeeopenFileAbsoluteZ
for a function that accepts a null-terminated path.fn openFileAbsoluteW(absolute_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File
Same as
openFileAbsolute
but the path parameter is WTF-16-encoded.fn openFileAbsoluteZ(absolute_path_c: [*:0]const u8, flags: File.OpenFlags) File.OpenError!File
Same as
openFileAbsolute
but the path parameter is null-terminated.fn openIterableDirAbsolute(absolute_path: []const u8, flags: Dir.OpenDirOptions) File.OpenError!IterableDir
Opens a directory at the given path. The directory is a system resource that rem…
Opens a directory at the given path. The directory is a system resource that remains open until
close
is called on the result. SeeopenIterableDirAbsoluteZ
for a function that accepts a null-terminated path.Asserts that the path parameter has no null bytes.
fn openIterableDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenDirOptions) File.OpenError!IterableDir
Same as
openIterableDirAbsolute
but the path parameter is null-terminated.fn openIterableDirAbsoluteZ(absolute_path_c: [*:0]const u8, flags: Dir.OpenDirOptions) File.OpenError!IterableDir
Same as
openIterableDirAbsolute
but the path parameter is null-terminated.fn readLinkAbsolute(pathname: []const u8, buffer: *[MAX_PATH_BYTES]u8) ![]u8
Same as
Dir.readLink
, except it asserts the path is absolute.fn readLinkAbsoluteZ(pathname_c: [*:0]const u8, buffer: *[MAX_PATH_BYTES]u8) ![]u8
Same as
readLink
, except the path parameter is null-terminated.fn readlinkAbsoluteW(pathname_w: [*:0]const u16, buffer: *[MAX_PATH_BYTES]u8) ![]u8
Windows-only. Same as
readlinkW
, except the path parameter is null-terminated,…Windows-only. Same as
readlinkW
, except the path parameter is null-terminated, WTF16 encoded.fn realpath(pathname: []const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8
No documentation provided.
fn realpathAlloc(allocator: Allocator, pathname: []const u8) ![]u8
realpath
, except caller must free the returned memory. See also `Dir.realpath…realpath
, except caller must free the returned memory. See alsoDir.realpath
.fn realpathW(pathname: []const u16, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8
No documentation provided.
fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8
No documentation provided.
fn rename(old_dir: Dir, old_sub_path: []const u8, new_dir: Dir, new_sub_path: []const u8) !void
Same as
Dir.rename
, exceptnew_sub_path
is relative tonew_dir
fn renameAbsolute(old_path: []const u8, new_path: []const u8) !void
Same as
Dir.rename
except the paths are absolute.fn renameAbsoluteW(old_path: [*:0]const u16, new_path: [*:0]const u16) !void
Same as
renameAbsolute
except the path parameters are WTF-16 and target OS is …Same as
renameAbsolute
except the path parameters are WTF-16 and target OS is assumed Windows.fn renameAbsoluteZ(old_path: [*:0]const u8, new_path: [*:0]const u8) !void
Same as
renameAbsolute
except the path parameters are null-terminated.fn renameW(old_dir: Dir, old_sub_path_w: []const u16, new_dir: Dir, new_sub_path_w: []const u16) !void
fn renameZ(old_dir: Dir, old_sub_path_z: [*:0]const u8, new_dir: Dir, new_sub_path_z: [*:0]const u8) !void
Same as
rename
except the parameters are null-terminated.fn selfExeDirPath(out_buffer: []u8) SelfExePathError![]const u8
Get the directory path that contains the current executable. Returned value is …
Get the directory path that contains the current executable. Returned value is a slice of out_buffer.
fn selfExeDirPathAlloc(allocator: Allocator) ![]u8
selfExeDirPath
except allocates the result on the heap. Caller owns returned …selfExeDirPath
except allocates the result on the heap. Caller owns returned memory.fn selfExePath(out_buffer: []u8) SelfExePathError![]u8
Get the path to the current executable. If you only need the directory, use sel…
Get the path to the current executable. If you only need the directory, use selfExeDirPath. If you only want an open file handle, use openSelfExe. This function may return an error if the current executable was deleted after spawning. Returned value is a slice of out_buffer.
On Linux, depends on procfs being mounted. If the currently executing binary has been deleted, the file path looks something like
/a/b/c/exe (deleted)
. TODO make the return type of this a null terminated pointerfn selfExePathAlloc(allocator: Allocator) ![]u8
selfExePath
except allocates the result on the heap. Caller owns returned mem…selfExePath
except allocates the result on the heap. Caller owns returned memory.fn symLinkAbsolute(target_path: []const u8, sym_link_path: []const u8, flags: SymLinkFlags) !void
Creates a symbolic link named
sym_link_path
which contains the string `target_…Creates a symbolic link named
sym_link_path
which contains the stringtarget_path
. A symbolic link (also known as a soft link) may point to an existing file or to a nonexistent one; the latter case is known as a dangling link. Ifsym_link_path
exists, it will not be overwritten. See alsosymLinkAbsoluteZ
andsymLinkAbsoluteW
.fn symLinkAbsoluteW(target_path_w: []const u16, sym_link_path_w: []const u16, flags: SymLinkFlags) !void
Windows-only. Same as
symLinkAbsolute
except the parameters are null-terminate…Windows-only. Same as
symLinkAbsolute
except the parameters are null-terminated, WTF16 encoded. Note that this function will by default try creating a symbolic link to a file. If you would like to create a symbolic link to a directory, specify this withSymLinkFlags{ .is_directory = true }
. See alsosymLinkAbsolute
,symLinkAbsoluteZ
.fn symLinkAbsoluteZ(target_path_c: [*:0]const u8, sym_link_path_c: [*:0]const u8, flags: SymLinkFlags) !void
Same as
symLinkAbsolute
except the parameters are null-terminated pointers. S…Same as
symLinkAbsolute
except the parameters are null-terminated pointers. See alsosymLinkAbsolute
.fn updateFileAbsolute(source_path: []const u8, dest_path: []const u8, args: CopyFileOptions) !PrevStatus
Same as
Dir.updateFile
, except asserts that bothsource_path
anddest_path
…Same as
Dir.updateFile
, except asserts that bothsource_path
anddest_path
are absolute. SeeDir.updateFile
for a function that operates on both absolute and relative paths.
Values
MAX_NAME_BYTES | type | This represents the maximum size of a UTF-8 encoded file name component that th… |
MAX_PATH_BYTES | type | This represents the maximum size of a UTF-8 encoded file path that the operatin… |
OpenSelfExeError | type | |
SelfExePathError | type | |
base64_alphabet | undefined | |
base64_decoder | undefined | Base64 decoder, replacing the standard |
base64_encoder | undefined | Base64 encoder, replacing the standard |
has_executable_bit | type | |
need_async_thread | bool | Whether or not async file system syscalls need a dedicated thread because the op… |