Remove the redundant check and directly use dir()

This commit is contained in:
Bryan Lee
2025-01-03 00:21:44 +08:00
parent 9f44ec7c21
commit 6fca26972b

View File

@ -30,13 +30,6 @@ pub fn config(alloc: Allocator, opts: Options) ![]u8 {
/// Get the XDG cache directory. The returned value is allocated. /// Get the XDG cache directory. The returned value is allocated.
pub fn cache(alloc: Allocator, opts: Options) ![]u8 { pub fn cache(alloc: Allocator, opts: Options) ![]u8 {
if (posix.getenv("XDG_CACHE_HOME")) |env| {
return try std.fs.path.join(alloc, &[_][]const u8{
env,
opts.subdir orelse "",
});
}
return try dir(alloc, opts, .{ return try dir(alloc, opts, .{
.env = "XDG_CACHE_HOME", .env = "XDG_CACHE_HOME",
.windows_env = "LOCALAPPDATA", .windows_env = "LOCALAPPDATA",