aboutsummaryrefslogtreecommitdiff
path: root/src/introspect.zig
diff options
context:
space:
mode:
authorMichael Dusan <michael.dusan@gmail.com>2021-03-25 18:20:32 -0400
committerMichael Dusan <michael.dusan@gmail.com>2021-03-25 22:05:21 -0400
commit9f01598a498ecbd868cb81dc1efdb1507010c1b8 (patch)
tree6915ea659078be32b9592dfa6f88d80a171fa244 /src/introspect.zig
parentf1e324216d934ee6be0d8a4ab579353e2fc73bad (diff)
downloadzig-9f01598a498ecbd868cb81dc1efdb1507010c1b8.tar.gz
zig-9f01598a498ecbd868cb81dc1efdb1507010c1b8.zip
zig build: use ZIG_GLOBAL_CACHE_DIR
- move ZIG_GLOBAL_CACHE_DIR to `introspect` - cleanup some dead fields from stage1 codegen
Diffstat (limited to 'src/introspect.zig')
-rw-r--r--src/introspect.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/introspect.zig b/src/introspect.zig
index b75bf8f4b8..18cad4cf81 100644
--- a/src/introspect.zig
+++ b/src/introspect.zig
@@ -61,6 +61,14 @@ pub fn findZigLibDirFromSelfExe(
/// Caller owns returned memory.
pub fn resolveGlobalCacheDir(allocator: *mem.Allocator) ![]u8 {
+ if (std.process.getEnvVarOwned(allocator, "ZIG_GLOBAL_CACHE_DIR")) |value| {
+ if (value.len > 0) {
+ return value;
+ } else {
+ allocator.free(value);
+ }
+ } else |_| {}
+
const appname = "zig";
if (std.Target.current.os.tag != .windows) {