From 09a9219c9e74c63911ad8e991d909052c1c0f492 Mon Sep 17 00:00:00 2001 From: Ronald M Zielaznicki Date: Fri, 18 Oct 2024 16:06:44 -0400 Subject: [PATCH] fix(#1142) --- build.zig | 2 +- msvc.zig | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.zig b/build.zig index 6c2d45d..d91cc2a 100644 --- a/build.zig +++ b/build.zig @@ -254,7 +254,7 @@ pub fn build(b: *Build) !void { // For some reason, msvc target needs atls.lib to be in the 'zig build' working directory. // Addomg tp the library path like this has no effect: - dxc_exe.addLibraryPath(b.path(lib_dir_path)); + dxc_exe.addLibraryPath(.{ .cwd_relative = lib_dir_path }); // So instead we must copy the lib into this directory: try std.fs.cwd().copyFile(lib_path, std.fs.cwd(), "atls.lib", .{}); try std.fs.cwd().copyFile(pdb_path, std.fs.cwd(), pdb_name, .{}); diff --git a/msvc.zig b/msvc.zig index 307818e..0c4c455 100644 --- a/msvc.zig +++ b/msvc.zig @@ -135,7 +135,7 @@ const RegistryUtf8 = struct { const value_utf16le = try registry_utf16le.getString(allocator, subkey_utf16le, value_name_utf16le); defer allocator.free(value_utf16le); - const value_utf8: []u8 = std.unicode.utf16leToUtf8Alloc(allocator, value_utf16le) catch |err| switch (err) { + const value_utf8: []u8 = std.unicode.utf16LeToUtf8Alloc(allocator, value_utf16le) catch |err| switch (err) { error.OutOfMemory => return error.OutOfMemory, else => return error.StringNotFound, }; @@ -368,7 +368,7 @@ pub const Windows10Sdk = struct { error.OutOfMemory => return error.OutOfMemory, }; - if (path_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) { + if (path_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) { allocator.free(path_maybe_with_trailing_slash); return error.PathTooLong; } @@ -414,7 +414,7 @@ pub const Windows10Sdk = struct { /// Check whether this version is enumerated in registry. fn isValidVersion(windows10sdk: *const Windows10Sdk) bool { - var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; + var buf: [std.fs.max_path_bytes]u8 = undefined; const reg_query_as_utf8 = std.fmt.bufPrint(buf[0..], "{s}\\{s}\\Installed Options", .{ WINDOWS_KIT_REG_KEY, windows10sdk.version }) catch |err| switch (err) { error.NoSpaceLeft => return false, }; @@ -458,7 +458,7 @@ pub const Windows81Sdk = struct { error.OutOfMemory => return error.OutOfMemory, }; - if (path_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) { + if (path_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) { allocator.free(path_maybe_with_trailing_slash); return error.PathTooLong; } @@ -475,7 +475,7 @@ pub const Windows81Sdk = struct { errdefer allocator.free(path); const version: []const u8 = version81: { - var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; + var buf: [std.fs.max_path_bytes]u8 = undefined; const sdk_lib_dir_path = std.fmt.bufPrint(buf[0..], "{s}\\Lib\\", .{path}) catch |err| switch (err) { error.NoSpaceLeft => return error.PathTooLong, }; @@ -822,7 +822,7 @@ pub const MsvcLibDir = struct { error.OutOfMemory => return error.OutOfMemory, else => continue, }; - if (source_directories_value.len > (std.fs.MAX_PATH_BYTES * 30)) { // note(bratishkaerik): guessing from the fact that on my computer it has 15 pathes and at least some of them are not of max length + if (source_directories_value.len > (std.fs.max_path_bytes * 30)) { // note(bratishkaerik): guessing from the fact that on my computer it has 15 pathes and at least some of them are not of max length allocator.free(source_directories_value); continue; } @@ -836,7 +836,7 @@ pub const MsvcLibDir = struct { const msvc_dir: []const u8 = msvc_dir: { const msvc_include_dir_maybe_with_trailing_slash = try allocator.dupe(u8, source_directories_splitted.first()); - if (msvc_include_dir_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(msvc_include_dir_maybe_with_trailing_slash)) { + if (msvc_include_dir_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(msvc_include_dir_maybe_with_trailing_slash)) { allocator.free(msvc_include_dir_maybe_with_trailing_slash); return error.PathNotFound; } @@ -904,7 +904,7 @@ pub const MsvcLibDir = struct { else => break :try_vs7_key, }; - if (path_maybe_with_trailing_slash.len > std.fs.MAX_PATH_BYTES or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) { + if (path_maybe_with_trailing_slash.len > std.fs.max_path_bytes or !std.fs.path.isAbsolute(path_maybe_with_trailing_slash)) { allocator.free(path_maybe_with_trailing_slash); break :try_vs7_key; }