aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/Cache.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-05-16 16:29:20 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-05-16 16:41:22 -0700
commitae119a9a8d5b8dec21bd314e91afcec122eb8631 (patch)
treeb47079e19cee86e8f244be48dd29b0666336743d /lib/std/Build/Cache.zig
parent2e692312f104e1e5533c9f389d73488ea4a1ef68 (diff)
downloadzig-ae119a9a8d5b8dec21bd314e91afcec122eb8631.tar.gz
zig-ae119a9a8d5b8dec21bd314e91afcec122eb8631.zip
CLI: fix stdin dumping behavior
* no need to move `tmpFilePath` around * no need for calculating max length of `FileExt` tag name * provide a canonical file extension name for `FileExt` so that, e.g. the file will be named `stdin.S` instead of `stdin.assembly_with_cpp`. * move temp file cleanup to a function to reduce defer bloat in a large function. * fix bug caused by mixing relative and absolute paths in the cleanup logic. * remove commented out test and dead code
Diffstat (limited to 'lib/std/Build/Cache.zig')
-rw-r--r--lib/std/Build/Cache.zig10
1 files changed, 0 insertions, 10 deletions
diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig
index 4fc6784684..17429c0370 100644
--- a/lib/std/Build/Cache.zig
+++ b/lib/std/Build/Cache.zig
@@ -31,16 +31,6 @@ pub const Directory = struct {
}
}
- pub fn tmpFilePath(self: Directory, ally: Allocator, suffix: []const u8) error{OutOfMemory}![]const u8 {
- const s = std.fs.path.sep_str;
- const rand_int = std.crypto.random.int(u64);
- if (self.path) |p| {
- return std.fmt.allocPrint(ally, "{s}" ++ s ++ "tmp" ++ s ++ "{x}-{s}", .{ p, rand_int, suffix });
- } else {
- return std.fmt.allocPrint(ally, "tmp" ++ s ++ "{x}-{s}", .{ rand_int, suffix });
- }
- }
-
/// Whether or not the handle should be closed, or the path should be freed
/// is determined by usage, however this function is provided for convenience
/// if it happens to be what the caller needs.