struct TmpDir [src]

Fields

dir: std.fs.Dir
parent_dir: std.fs.Dir
sub_path: [sub_path_len]u8

Members

Source

pub const TmpDir = struct { dir: std.fs.Dir, parent_dir: std.fs.Dir, sub_path: [sub_path_len]u8, const random_bytes_count = 12; const sub_path_len = std.fs.base64_encoder.calcSize(random_bytes_count); pub fn cleanup(self: *TmpDir) void { self.dir.close(); self.parent_dir.deleteTree(&self.sub_path) catch {}; self.parent_dir.close(); self.* = undefined; } }