mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-31 17:11:22 +00:00
windows: add trivial implementation of expandHome
This commit is contained in:
@@ -13,7 +13,7 @@ const Error = error{
|
|||||||
/// is generally an expensive process so the value should be cached.
|
/// is generally an expensive process so the value should be cached.
|
||||||
pub inline fn home(buf: []u8) !?[]const u8 {
|
pub inline fn home(buf: []u8) !?[]const u8 {
|
||||||
return switch (builtin.os.tag) {
|
return switch (builtin.os.tag) {
|
||||||
inline .linux, .freebsd, .macos => try homeUnix(buf),
|
.linux, .freebsd, .macos => try homeUnix(buf),
|
||||||
.windows => try homeWindows(buf),
|
.windows => try homeWindows(buf),
|
||||||
|
|
||||||
// iOS doesn't have a user-writable home directory
|
// 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 {
|
pub fn expandHome(path: []const u8, buf: []u8) ExpandError![]const u8 {
|
||||||
return switch (builtin.os.tag) {
|
return switch (builtin.os.tag) {
|
||||||
.linux, .freebsd, .macos => try expandHomeUnix(path, buf),
|
.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,
|
.ios => return path,
|
||||||
|
|
||||||
else => @compileError("unimplemented"),
|
else => @compileError("unimplemented"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user