| ... | @@ -5002,8 +5002,16 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { | ... | @@ -5002,8 +5002,16 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void { |
| 5002 | | 5002 | |
| 5003 | var global_cache_directory: Directory = l: { | 5003 | var global_cache_directory: Directory = l: { |
| 5004 | const p = override_global_cache_dir orelse try introspect.resolveGlobalCacheDir(arena); | 5004 | const p = override_global_cache_dir orelse try introspect.resolveGlobalCacheDir(arena); |
| | 5005 | const dir = fs.cwd().makeOpenPath(p, .{}) catch |err| { |
| | 5006 | const base_msg = "unable to open or create the global Zig cache at '{s}': {s}.{s}"; |
| | 5007 | const extra = "\nIf this location is not writable then consider specifying an " ++ |
| | 5008 | "alternative with the ZIG_GLOBAL_CACHE_DIR environment variable or the " ++ |
| | 5009 | "--global-cache-dir option."; |
| | 5010 | const show_extra = err == error.AccessDenied or err == error.ReadOnlyFileSystem; |
| | 5011 | fatal(base_msg, .{ p, @errorName(err), if (show_extra) extra else "" }); |
| | 5012 | }; |
| 5005 | break :l .{ | 5013 | break :l .{ |
| 5006 | .handle = try fs.cwd().makeOpenPath(p, .{}), | 5014 | .handle = dir, |
| 5007 | .path = p, | 5015 | .path = p, |
| 5008 | }; | 5016 | }; |
| 5009 | }; | 5017 | }; |