Functions

fn basename(path: []const u8) []const u8

No documentation provided.

fn basenamePosix(path: []const u8) []const u8

No documentation provided.

fn basenameWindows(path: []const u8) []const u8

No documentation provided.

fn componentIterator(path: []const u8) !NativeUtf8ComponentIterator

No documentation provided.

fn dirname(path: []const u8) ?[]const u8

Strip the last component from a file path.

Strip the last component from a file path.

If the path is a file in the current directory (no directory component) then returns null.

If the path is the root directory, returns null.

fn dirnamePosix(path: []const u8) ?[]const u8

No documentation provided.

fn dirnameWindows(path: []const u8) ?[]const u8

No documentation provided.

fn diskDesignator(path: []const u8) []const u8

No documentation provided.

fn diskDesignatorWindows(path: []const u8) []const u8

No documentation provided.

fn extension(path: []const u8) []const u8

Searches for a file extension separated by a . and returns the string after th…

Searches for a file extension separated by a . and returns the string after that .. Files that end or start with . and have no other . in their name are considered to have no extension, in which case this returns “”. Examples:

  • "main.zig"".zig"
  • "src/main.zig"".zig"
  • ".gitignore"""
  • ".image.png"".png"
  • "keep.""."
  • "src.keep.me"".me"
  • "/src/keep.me"".me"
  • "/src/keep.me/"".me" The returned slice is guaranteed to have its pointer within the start and end pointer address range of path, even if it is length zero.
fn isAbsolute(path: []const u8) bool

No documentation provided.

fn isAbsolutePosix(path: []const u8) bool

No documentation provided.

fn isAbsolutePosixZ(path_c: [*:0]const u8) bool

No documentation provided.

fn isAbsoluteWindows(path: []const u8) bool

No documentation provided.

fn isAbsoluteWindowsW(path_w: [*:0]const u16) bool

No documentation provided.

fn isAbsoluteWindowsWTF16(path: []const u16) bool

No documentation provided.

fn isAbsoluteWindowsZ(path_c: [*:0]const u8) bool

No documentation provided.

fn isAbsoluteZ(path_c: [*:0]const u8) bool

No documentation provided.

fn isSep(byte: u8) bool

Returns if the given byte is a valid path separator

fn join(allocator: Allocator, paths: []const []const u8) ![]u8

Naively combines a series of paths with the native path separator. Allocates me…

Naively combines a series of paths with the native path separator. Allocates memory for the result, which must be freed by the caller.

fn joinZ(allocator: Allocator, paths: []const []const u8) ![:0]u8

Naively combines a series of paths with the native path separator and null termi…

Naively combines a series of paths with the native path separator and null terminator. Allocates memory for the result, which must be freed by the caller.

fn relative(allocator: Allocator, from: []const u8, to: []const u8) ![]u8

Returns the relative path from from to to. If from and to each resolve …

Returns the relative path from from to to. If from and to each resolve to the same path (after calling resolve on each), a zero-length string is returned. On Windows this canonicalizes the drive to a capital letter and paths to \\.

fn relativePosix(allocator: Allocator, from: []const u8, to: []const u8) ![]u8

No documentation provided.

fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) ![]u8

No documentation provided.

fn resolve(allocator: Allocator, paths: []const []const u8) ![]u8

On Windows, this calls resolveWindows and on POSIX it calls resolvePosix.

fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.Error![]u8

This function is like a series of cd statements executed one after another. I…

This function is like a series of cd statements executed one after another. It resolves “.” and “..”, but will not convert relative path to absolute path, use std.fs.Dir.realpath instead. The result does not have a trailing path separator. This function does not perform any syscalls. Executing this series of path lookups on the actual filesystem may produce different results due to symlinks.

fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8

This function is like a series of cd statements executed one after another. I…

This function is like a series of cd statements executed one after another. It resolves “.” and “..”, but will not convert relative path to absolute path, use std.fs.Dir.realpath instead. The result does not have a trailing path separator. Each drive has its own current working directory. Path separators are canonicalized to ‘\’ and drives are canonicalized to capital letters. Note: all usage of this function should be audited due to the existence of symlinks. Without performing actual syscalls, resolving .. could be incorrect. This API may break in the future: https://github.com/ziglang/zig/issues/13613

fn stem(path: []const u8) []const u8

Returns the last component of this path without its extension (if any):

  • “hell…

Returns the last component of this path without its extension (if any):

  • “hello/world/lib.tar.gz” ⇒ “lib.tar”
  • “hello/world/lib.tar” ⇒ “lib”
  • “hello/world/lib” ⇒ “lib”
fn windowsParsePath(path: []const u8) WindowsPath

No documentation provided.

Values

NativeUtf8ComponentIterator
undefined
delimiter
type
delimiter_posix
comptime_int
delimiter_windows
comptime_int
sep
type
sep_posix
comptime_int
sep_str
type
sep_str_posix
*const [1:0]u8
sep_str_windows
*const [1:0]u8
sep_windows
comptime_int