| ... | @@ -419,10 +419,10 @@ pub fn getEnvVarOwned(allocator: Allocator, key: []const u8) GetEnvVarOwnedError | ... | @@ -419,10 +419,10 @@ pub fn getEnvVarOwned(allocator: Allocator, key: []const u8) GetEnvVarOwnedError |
| 419 | } | 419 | } |
| 420 | } | 420 | } |
| 421 | | 421 | |
| 422 | /// On Windows, `key` must be valid UTF-8. | 422 | /// On Windows, `key` must be valid WTF-8. |
| 423 | pub fn hasEnvVarConstant(comptime key: []const u8) bool { | 423 | pub fn hasEnvVarConstant(comptime key: []const u8) bool { |
| 424 | if (native_os == .windows) { | 424 | if (native_os == .windows) { |
| 425 | const key_w = comptime unicode.utf8ToUtf16LeStringLiteral(key); | 425 | const key_w = comptime unicode.wtf8ToWtf16LeStringLiteral(key); |
| 426 | return getenvW(key_w) != null; | 426 | return getenvW(key_w) != null; |
| 427 | } else if (native_os == .wasi and !builtin.link_libc) { | 427 | } else if (native_os == .wasi and !builtin.link_libc) { |
| 428 | @compileError("hasEnvVarConstant is not supported for WASI without libc"); | 428 | @compileError("hasEnvVarConstant is not supported for WASI without libc"); |
| ... | @@ -431,10 +431,10 @@ pub fn hasEnvVarConstant(comptime key: []const u8) bool { | ... | @@ -431,10 +431,10 @@ pub fn hasEnvVarConstant(comptime key: []const u8) bool { |
| 431 | } | 431 | } |
| 432 | } | 432 | } |
| 433 | | 433 | |
| 434 | /// On Windows, `key` must be valid UTF-8. | 434 | /// On Windows, `key` must be valid WTF-8. |
| 435 | pub fn hasNonEmptyEnvVarConstant(comptime key: []const u8) bool { | 435 | pub fn hasNonEmptyEnvVarConstant(comptime key: []const u8) bool { |
| 436 | if (native_os == .windows) { | 436 | if (native_os == .windows) { |
| 437 | const key_w = comptime unicode.utf8ToUtf16LeStringLiteral(key); | 437 | const key_w = comptime unicode.wtf8ToWtf16LeStringLiteral(key); |
| 438 | const value = getenvW(key_w) orelse return false; | 438 | const value = getenvW(key_w) orelse return false; |
| 439 | return value.len != 0; | 439 | return value.len != 0; |
| 440 | } else if (native_os == .wasi and !builtin.link_libc) { | 440 | } else if (native_os == .wasi and !builtin.link_libc) { |
| ... | @@ -451,10 +451,10 @@ pub const ParseEnvVarIntError = std.fmt.ParseIntError || error{EnvironmentVariab | ... | @@ -451,10 +451,10 @@ pub const ParseEnvVarIntError = std.fmt.ParseIntError || error{EnvironmentVariab |
| 451 | /// | 451 | /// |
| 452 | /// Since the key is comptime-known, no allocation is needed. | 452 | /// Since the key is comptime-known, no allocation is needed. |
| 453 | /// | 453 | /// |
| 454 | /// On Windows, `key` must be valid UTF-8. | 454 | /// On Windows, `key` must be valid WTF-8. |
| 455 | pub fn parseEnvVarInt(comptime key: []const u8, comptime I: type, base: u8) ParseEnvVarIntError!I { | 455 | pub fn parseEnvVarInt(comptime key: []const u8, comptime I: type, base: u8) ParseEnvVarIntError!I { |
| 456 | if (native_os == .windows) { | 456 | if (native_os == .windows) { |
| 457 | const key_w = comptime std.unicode.utf8ToUtf16LeStringLiteral(key); | 457 | const key_w = comptime std.unicode.wtf8ToWtf16LeStringLiteral(key); |
| 458 | const text = getenvW(key_w) orelse return error.EnvironmentVariableNotFound; | 458 | const text = getenvW(key_w) orelse return error.EnvironmentVariableNotFound; |
| 459 | return std.fmt.parseIntWithGenericCharacter(I, u16, text, base); | 459 | return std.fmt.parseIntWithGenericCharacter(I, u16, text, base); |
| 460 | } else if (native_os == .wasi and !builtin.link_libc) { | 460 | } else if (native_os == .wasi and !builtin.link_libc) { |