From 3aff764c2b5d613f766538d27e0b9f448e7ed5ca Mon Sep 17 00:00:00 2001 From: Gangzheng Tong Date: Mon, 8 Sep 2025 10:24:05 -0700 Subject: Use wide char version of Windows API (#8390) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR modernizes the Windows-specific code by replacing ANSI Windows API functions with their Unicode (wide character) counterparts. This change ensures proper handling of Unicode file paths and strings on Windows systems. ### File Operations (`source/core/slang-io.cpp`) - `DeleteFileA` → `DeleteFileW` - `GetTempPathA` → `GetTempPathW` - `GetTempFileNameA` → `GetTempFileNameW` - `RemoveDirectoryA` → `RemoveDirectoryW` - `SHFileOperationA` → `SHFileOperationW` - `GetModuleFileNameA` → `GetModuleFileNameW` with UTF-8 conversion ### Platform Operations (`source/core/slang-platform.cpp`) - `GetModuleHandleExA` → `GetModuleHandleExW` - `LoadLibraryExA` → `LoadLibraryExW` - `LoadLibraryA` → `LoadLibraryW` - `OutputDebugStringA` → `OutputDebugStringW` ### Runtime and Tools - `MessageBoxA` → `MessageBoxW` in slang-rt - `GetCurrentDirectoryA` → `GetCurrentDirectoryW` in slang-fiddle - String literal conversion to wide strings in vk-pipeline-create --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gangzheng Tong Co-authored-by: slangbot Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> --- source/slang-rt/slang-rt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/slang-rt/slang-rt.cpp') diff --git a/source/slang-rt/slang-rt.cpp b/source/slang-rt/slang-rt.cpp index 35ffdb138..d264ae300 100644 --- a/source/slang-rt/slang-rt.cpp +++ b/source/slang-rt/slang-rt.cpp @@ -16,7 +16,7 @@ extern "C" { fprintf(stderr, "%s", errorMessage.getBuffer()); #if SLANG_WINDOWS_FAMILY - MessageBoxA(0, errorMessage.getBuffer(), "Slang Runtime Error", MB_ICONERROR); + MessageBoxW(0, errorMessage.toWString(), L"Slang Runtime Error", MB_ICONERROR); #endif abort(); } -- cgit v1.2.3