Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › tar.zig › createDirAndFile
createDirAndFile
tar.createDirAndFile
fn createDirAndFile (io : Io , dir : Io .Dir , file_name : []const u8 , permissions : Io .File .Permissions ) !Io .File
File
Code
fn createDirAndFile (io : Io , dir : Io .Dir , file_name : []const u8 , permissions : Io .File .Permissions ) !Io .File {
const fs_file = dir .createFile (io , file_name , .{ .exclusive = true , .permissions = permissions }) catch |err | {
if (err == error .FileNotFound ) {
if (std .fs .path .dirname (file_name )) |dir_name | {
try dir .createDirPath (io , dir_name );
return try dir .createFile (io , file_name , .{ .exclusive = true , .permissions = permissions });
}
}
return err ;
};
return fs_file ;
}