create entire cache folder path

This commit is contained in:
Lee Cannon 2022-09-20 19:52:24 +01:00
parent 0fa788b727
commit f90142d0cc
No known key found for this signature in database
GPG Key ID: 983D5E5CC5E1401F

View File

@ -203,7 +203,6 @@ pub fn configChanged(config: *Config, allocator: std.mem.Allocator, builtin_crea
config.builtin_path = try std.fs.path.join(allocator, &.{ builtin_creation_dir.?, "builtin.zig" });
}
if (null == config.global_cache_path) {
const cache_dir_path = (try known_folders.getPath(allocator, .cache)) orelse {
logger.warn("Known-folders could not fetch the cache path", .{});
@ -213,7 +212,7 @@ pub fn configChanged(config: *Config, allocator: std.mem.Allocator, builtin_crea
config.global_cache_path = try std.fs.path.resolve(allocator, &[_][]const u8{ cache_dir_path, "zls" });
std.fs.makeDirAbsolute(config.global_cache_path.?) catch |err| switch(err) {
std.fs.cwd().makePath(config.global_cache_path.?) catch |err| switch (err) {
error.PathAlreadyExists => {},
else => return err,
};
@ -227,5 +226,4 @@ pub fn configChanged(config: *Config, allocator: std.mem.Allocator, builtin_crea
try file.writeAll(@embedFile("special/build_runner.zig"));
}
}