Compare commits

..

2 Commits

Author SHA1 Message Date
e6634d3c0f
shell32 has been removed, use USERPROFILE env var instead
Some checks failed
aws-zig mach nominated build / build-zig-nightly (push) Failing after 1h21m14s
aws-zig nightly build / build-zig-nightly (push) Failing after 10m24s
2024-04-02 11:05:17 -07:00
57e994f80f
upgrade to working smithy 2024-04-02 11:04:40 -07:00
2 changed files with 5 additions and 24 deletions

View File

@ -5,8 +5,8 @@
.dependencies = .{ .dependencies = .{
.smithy = .{ .smithy = .{
.url = "https://git.lerch.org/lobo/smithy/archive/0a54b5a3de67309417cf7c7dce8f8651cb2054f2.tar.gz", .url = "https://git.lerch.org/lobo/smithy/archive/1e534201c4df5ea4f615faeedc69d414adbec0b1.tar.gz",
.hash = "1220960423173015a19837e676bdb78cfcf2e09965b6b45c6c5514989d86b0c1f8d2", .hash = "1220af63ae0498010004af79936cedf3fe6702f516daab77ebbd97a274eba1b42aad",
}, },
.models = .{ .models = .{
.url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz", .url = "https://github.com/aws/aws-sdk-go-v2/archive/58cf6509525a12d64fd826da883bfdbacbd2f00e.tar.gz",

View File

@ -568,29 +568,10 @@ fn getDefaultPath(allocator: std.mem.Allocator, home_dir: ?[]const u8, dir: []co
fn getHomeDir(allocator: std.mem.Allocator) ![]const u8 { fn getHomeDir(allocator: std.mem.Allocator) ![]const u8 {
switch (builtin.os.tag) { switch (builtin.os.tag) {
.windows => { .windows => {
var dir_path_ptr: [*:0]u16 = undefined; return std.process.getEnvVarOwned(allocator, "USERPROFILE") catch |err| switch (err) {
// https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid error.OutOfMemory => |e| return e,
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, else => return error.HomeDirUnavailable,
} };
}, },
.macos, .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => { .macos, .linux, .freebsd, .netbsd, .dragonfly, .openbsd, .solaris => {
const home_dir = std.os.getenv("HOME") orelse { const home_dir = std.os.getenv("HOME") orelse {