We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ebf7a0 commit 0a4edadCopy full SHA for 0a4edad
lib/utils/Utils.cpp
@@ -125,10 +125,15 @@ namespace MAT_NS_BEGIN {
125
std::string GetTempDirectory()
126
{
127
#ifdef _WIN32
128
+ auto lpGetTempPathW = reinterpret_cast<decltype(&::GetTempPathW)>(GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetTempPath2W"));
129
+ if (lpGetTempPathW == NULL)
130
+ {
131
+ lpGetTempPathW = ::GetTempPathW;
132
+ }
133
/* UTF-8 temp directory for Win32 Desktop apps */
134
std::string path = "";
135
wchar_t lpTempPathBuffer[MAX_PATH + 1] = { 0 };
- if (::GetTempPathW(MAX_PATH, lpTempPathBuffer))
136
+ if (lpGetTempPathW(MAX_PATH, lpTempPathBuffer))
137
138
path = to_utf8_string(lpTempPathBuffer);
139
}
0 commit comments