mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user