The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/file: use GetTempPath on older Windows SDK versions

versions of the Windows SDK older than Windows 11 22000 do not
support GetTempPath2. furthermore, if Unicode support is not
enabled, use the ANSI versions of the functions.

amended to fix formatting

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2505>

Alex Niemi e8f9a069 2c8a7fe3

+12
+12
src/xrt/auxiliary/util/u_file.c
··· 208 208 } 209 209 210 210 #ifdef XRT_OS_WINDOWS 211 + #ifndef UNICODE // If Unicode support is disabled, use ANSI functions directly into out_path 212 + #ifdef GetTempPath2 // GetTempPath2 is only available on Windows 11 >= 22000, fallback to GetTempPath for older versions 213 + return (int)GetTempPath2A(out_path_size, out_path); 214 + #else 215 + return (int)GetTempPathA(out_path_size, out_path); 216 + #endif 217 + #else 211 218 WCHAR temp[MAX_PATH] = {0}; 219 + #ifdef GetTempPath2 // GetTempPath2 is only available on Windows 11 >= 22000, fallback to GetTempPath for older versions 212 220 GetTempPath2W(sizeof(temp), temp); 221 + #else // GetTempPath2 222 + GetTempPathW(sizeof(temp), temp); 223 + #endif 213 224 return wcstombs(out_path, temp, out_path_size); 225 + #endif // UNICODE 214 226 #else 215 227 const char *cache = "~/.cache"; 216 228 return snprintf(out_path, out_path_size, "%s", cache);