Merge pull request #667 from leecannon/master

create entire cache folder path
This commit is contained in:
Lee Cannon 2022-09-21 20:08:54 +01:00 committed by GitHub
commit dac0d9019a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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" }); config.builtin_path = try std.fs.path.join(allocator, &.{ builtin_creation_dir.?, "builtin.zig" });
} }
if (null == config.global_cache_path) { if (null == config.global_cache_path) {
const cache_dir_path = (try known_folders.getPath(allocator, .cache)) orelse { const cache_dir_path = (try known_folders.getPath(allocator, .cache)) orelse {
logger.warn("Known-folders could not fetch the cache path", .{}); 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" }); 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 => {}, error.PathAlreadyExists => {},
else => return err, 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")); try file.writeAll(@embedFile("special/build_runner.zig"));
} }
} }