windows: add trivial implementation of expandHome

This commit is contained in:
Jeffrey C. Ollie
2026-03-05 09:28:02 -06:00
parent e8aad10326
commit cccdb0d2ad

View File

@@ -13,7 +13,7 @@ const Error = error{
/// is generally an expensive process so the value should be cached.
pub inline fn home(buf: []u8) !?[]const u8 {
return switch (builtin.os.tag) {
inline .linux, .freebsd, .macos => try homeUnix(buf),
.linux, .freebsd, .macos => try homeUnix(buf),
.windows => try homeWindows(buf),
// iOS doesn't have a user-writable home directory
@@ -122,7 +122,13 @@ pub const ExpandError = error{
pub fn expandHome(path: []const u8, buf: []u8) ExpandError![]const u8 {
return switch (builtin.os.tag) {
.linux, .freebsd, .macos => try expandHomeUnix(path, buf),
// `~/` is not an idiom generally used on Windows
.windows => return path,
// iOS doesn't have a user-writable home directory
.ios => return path,
else => @compileError("unimplemented"),
};
}