Function makeTempPath [src]
This function is intended to be called in the configure phase only.
It returns an absolute directory path, which is potentially going to be a
source of API breakage in the future, so keep that in mind when using this
function.
Prototype
pub fn makeTempPath(b: *Build) []const u8
Parameters
b: *Build
Source
pub fn makeTempPath(b: *Build) []const u8 {
const rand_int = std.crypto.random.int(u64);
const tmp_dir_sub_path = "tmp" ++ fs.path.sep_str ++ std.fmt.hex(rand_int);
const result_path = b.cache_root.join(b.allocator, &.{tmp_dir_sub_path}) catch @panic("OOM");
b.cache_root.handle.makePath(tmp_dir_sub_path) catch |err| {
std.debug.print("unable to make tmp path '{s}': {s}\n", .{
result_path, @errorName(err),
});
};
return result_path;
}