diff --git a/onnxruntime/test/webgpu/delay_load/main.cc b/onnxruntime/test/webgpu/delay_load/main.cc index 357cb0055d5a8..68715b3dc6c5f 100644 --- a/onnxruntime/test/webgpu/delay_load/main.cc +++ b/onnxruntime/test/webgpu/delay_load/main.cc @@ -43,10 +43,10 @@ int wmain(int argc, wchar_t* argv[]) { } int prepare_main() { - WCHAR path[32768]; - GetModuleFileNameW(NULL, path, 32768); + std::wstring path_str(32768, L'\0'); + GetModuleFileNameW(NULL, path_str.data(), static_cast(path_str.size())); + namespace fs = std::filesystem; - std::wstring path_str(path); fs::path exe_full_path{path_str}; // /onnxruntime_webgpu_delay_load_test.exe fs::path test_dir = exe_full_path.parent_path(); // / fs::path exe_name = exe_full_path.filename(); // onnxruntime_webgpu_delay_load_test.exe