std/io/os/temp_directory.c3: fix INVALID_PATH in Win32 native_temp_directory (#2762)

* std/io/os/temp_directory.c3: fix INVALID_PATH in Windows native_temp_directory

- Use the actual length from GetTempPathW for Windows temp path slice
- We can remove the workaround in the test_suite_runner for WIN32 and
create all directories in %temp% now

* Updated releasenotes.

---------

Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
Manu Linares
2026-01-15 17:23:30 -03:00
committed by GitHub
parent 8a1c02c840
commit f254c27966
3 changed files with 6 additions and 8 deletions

View File

@@ -122,9 +122,10 @@ fn Path? native_temp_directory(Allocator allocator) @if(env::WIN32) => @pool()
{
Win32_DWORD len = win32::getTempPathW(0, null);
if (!len) return io::GENERAL_ERROR?;
Char16[] buff = mem::talloc_array(Char16, len + (usz)1);
if (!win32::getTempPathW(len, buff)) return io::GENERAL_ERROR?;
return path::new(allocator, string::tfrom_utf16(buff[:len]));
Char16[] buff = mem::talloc_array(Char16, len);
Win32_DWORD res = win32::getTempPathW(len, buff);
if (!res) return io::GENERAL_ERROR?;
return path::new(allocator, string::tfrom_utf16(buff[:res]));
}
module std::io::os @if(env::NO_LIBC);