Function deleteTreeAbsolute [src]

Removes a symlink, file, or directory. This is equivalent to Dir.deleteTree with the base directory. Asserts that the path is absolute. See Dir.deleteTree for a function that operates on both absolute and relative paths. Asserts that the path parameter has no null bytes. On Windows, absolute_path should be encoded as WTF-8. On WASI, absolute_path should be encoded as valid UTF-8. On other platforms, absolute_path is an opaque sequence of bytes with no particular encoding.

Prototype

pub fn deleteTreeAbsolute(absolute_path: []const u8) !void

Parameters

absolute_path: []const u8

Source

pub fn deleteTreeAbsolute(absolute_path: []const u8) !void { assert(path.isAbsolute(absolute_path)); const dirname = path.dirname(absolute_path) orelse return error{ /// Attempt to remove the root file system path. /// This error is unreachable if `absolute_path` is relative. CannotDeleteRootDirectory, }.CannotDeleteRootDirectory; var dir = try cwd().openDir(dirname, .{}); defer dir.close(); return dir.deleteTree(path.basename(absolute_path)); }