Skip to content

Commit ea61f8f

Browse files
authored
Merge branch 'main' into main
2 parents 19fc7ca + 0a4edad commit ea61f8f

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/utils/Utils.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,15 @@ namespace MAT_NS_BEGIN {
125125
std::string GetTempDirectory()
126126
{
127127
#ifdef _WIN32
128+
auto lpGetTempPathW = reinterpret_cast<decltype(&::GetTempPathW)>(GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetTempPath2W"));
129+
if (lpGetTempPathW == NULL)
130+
{
131+
lpGetTempPathW = ::GetTempPathW;
132+
}
128133
/* UTF-8 temp directory for Win32 Desktop apps */
129134
std::string path = "";
130135
wchar_t lpTempPathBuffer[MAX_PATH + 1] = { 0 };
131-
if (::GetTempPathW(MAX_PATH, lpTempPathBuffer))
136+
if (lpGetTempPathW(MAX_PATH, lpTempPathBuffer))
132137
{
133138
path = to_utf8_string(lpTempPathBuffer);
134139
}

tests/functests/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,14 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests)
3535
${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/ECSConfigCacheFuncTests.cpp
3636
)
3737
if (EXISTS ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json)
38-
file(COPY_FILE ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json)
38+
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.21")
39+
# Use file(COPY_FILE ...) for CMake 3.21 and later
40+
file(COPY_FILE ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json ${CMAKE_BINARY_DIR}/test.json)
41+
else()
42+
# Use file(COPY ...) as an alternative for older versions
43+
file(COPY ${CMAKE_SOURCE_DIR}/lib/modules/exp/tests/functests/test.json
44+
DESTINATION ${CMAKE_BINARY_DIR})
45+
endif()
3946
endif()
4047
endif()
4148

0 commit comments

Comments
 (0)