Compare commits
No commits in common. "e6634d3c0f96f9cd8f1348a7a695d0a23d3030b6" and "d46cb9c28bd144d8fc49908c9e3f0061842ad772" have entirely different histories.
e6634d3c0f
...
d46cb9c28b
|
@ -5,8 +5,8 @@
|
|||
|
||||
.dependencies = .{
|
||||
.smithy = .{
|
||||
.url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz",
|
||||
.hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
|
||||
.url = "https://git.lerch.org/lobo/smithy/archive/0a54b5a3de67309417cf7c7dce8f8651cb2054f2.tar.gz",
|
||||
.hash = "1220960423173015a19837e676bdb78cfcf2e09965b6b45c6c5514989d86b0c1f8d2",
|
||||
},
|
||||
.models = .{
|
||||
.url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz",
|
||||
|
|
|
@ -568,10 +568,29 @@ fn getDefaultPath(allocator: std.mem.Allocator, home_dir: ?[]const u8, dir: []co
|
|||
fn getHomeDir(allocator: std.mem.Allocator) ![]const u8 {
|
||||
switch (builtin.os.tag) {
|
||||
.windows => {
|
||||
return std.process.getEnvVarOwned(allocator, "USERPROFILE") catch |err| switch (err) {
|
||||
error.OutOfMemory => |e| return e,
|
||||
else => return error.HomeDirUnavailable,
|
||||
var dir_path_ptr: [*:0]u16 = undefined;
|
||||
// https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid
|
||||
const FOLDERID_Profile = std.os.windows.GUID.parse("{5E6C858F-0E22-4760-9AFE-EA3317B67173}");
|
||||
switch (std.os.windows.shell32.SHGetKnownFolderPath(
|
||||
&FOLDERID_Profile,
|
||||
std.os.windows.KF_FLAG_CREATE,
|
||||
null,
|
||||
&dir_path_ptr,
|
||||
)) {
|
||||
std.os.windows.S_OK => {
|
||||
defer std.os.windows.ole32.CoTaskMemFree(@as(*anyopaque, @ptrCast(dir_path_ptr)));
|
||||
const global_dir = std.unicode.utf16leToUtf8Alloc(allocator, std.mem.sliceTo(dir_path_ptr, 0)) catch |err| switch (err) {
|
||||
error.UnexpectedSecondSurrogateHalf => return error.HomeDirUnavailable,
|
||||
error.ExpectedSecondSurrogateHalf => return error.HomeDirUnavailable,
|
||||
error.DanglingSurrogateHalf => return error.HomeDirUnavailable,
|
||||
error.OutOfMemory => return error.OutOfMemory,
|
||||
};
|
||||
return global_dir;
|
||||
// defer allocator.free(global_dir);
|
||||
},
|
||||
std.os.windows.E_OUTOFMEMORY => return error.OutOfMemory,
|
||||
else => return error.HomeDirUnavailable,
|
||||
}
|
||||
},
|
||||
.macos, .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => {
|
||||
const home_dir = std.os.getenv("HOME") orelse {
|
||||
|
|
Loading…
Reference in New Issue
Block a user