diff --git a/aurora-main/lib/webgpu/gpu_cache.cpp b/aurora-main/lib/webgpu/gpu_cache.cpp index 8f98fe4..4f52738 100644 --- a/aurora-main/lib/webgpu/gpu_cache.cpp +++ b/aurora-main/lib/webgpu/gpu_cache.cpp @@ -165,8 +165,12 @@ static bool cache_init_core() { db = nullptr; std::error_code ec; std::filesystem::remove(path, ec); - std::filesystem::remove(std::filesystem::path{file + "-wal"}, ec); - std::filesystem::remove(std::filesystem::path{file + "-shm"}, ec); + auto wal = path; + wal += "-wal"; + std::filesystem::remove(wal, ec); + auto shm = path; + shm += "-shm"; + std::filesystem::remove(shm, ec); ret = sqlite3_open(file.c_str(), &db); if (ret != SQLITE_OK) { Log.error("Failed to recreate database: {}", sqlite3_errmsg(db)); diff --git a/runtime/src/main.cpp b/runtime/src/main.cpp index 077310a..0378645 100644 --- a/runtime/src/main.cpp +++ b/runtime/src/main.cpp @@ -578,11 +578,23 @@ std::string FormatHostStackTrace(unsigned framesToSkip) { &module) != 0 && module != nullptr) { moduleBase = reinterpret_cast(module); - wchar_t modulePathBuffer[MAX_PATH] = L""; - const DWORD length = GetModuleFileNameW(module, modulePathBuffer, MAX_PATH); - if (length != 0) { - modulePath = RuntimeConfigFile::PathToUtf8( - std::filesystem::path(std::wstring(modulePathBuffer, length))); + std::wstring modulePathBuffer(MAX_PATH, L'\0'); + for (;;) { + const DWORD length = + GetModuleFileNameW(module, modulePathBuffer.data(), static_cast(modulePathBuffer.size())); + if (length == 0) { + break; + } + if (length < modulePathBuffer.size()) { + modulePathBuffer.resize(length); + modulePath = RuntimeConfigFile::PathToUtf8(std::filesystem::path(modulePathBuffer)); + break; + } + // Truncated; retry with a larger buffer up to the extended path limit. + if (modulePathBuffer.size() >= 32768) { + break; + } + modulePathBuffer.resize(modulePathBuffer.size() * 2); } }