Function makeOpenPath [src]

This function performs makePath, followed by openDir. If supported by the OS, this operation is atomic. It is not atomic on all operating systems. On Windows, sub_path should be encoded as WTF-8. On WASI, sub_path should be encoded as valid UTF-8. On other platforms, sub_path is an opaque sequence of bytes with no particular encoding.

Prototype

pub fn makeOpenPath(self: Dir, sub_path: []const u8, open_dir_options: OpenOptions) (MakeError || OpenError || StatFileError)!Dir

Parameters

self: Dirsub_path: []const u8open_dir_options: OpenOptions

Source

pub fn makeOpenPath(self: Dir, sub_path: []const u8, open_dir_options: OpenOptions) (MakeError || OpenError || StatFileError)!Dir { return switch (native_os) { .windows => { const w = windows; const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA | w.SYNCHRONIZE | w.FILE_TRAVERSE | (if (open_dir_options.iterate) w.FILE_LIST_DIRECTORY else @as(u32, 0)); return self.makeOpenPathAccessMaskW(sub_path, base_flags, open_dir_options.no_follow); }, else => { return self.openDir(sub_path, open_dir_options) catch |err| switch (err) { error.FileNotFound => { try self.makePath(sub_path); return self.openDir(sub_path, open_dir_options); }, else => |e| return e, }; }, }; }