v29.4-roots.4 · Commit 1: [PATCH 01/37] build: port platform and dependency support
depends/patches/qt/qdir_temppath.patch
Before: /dev/null · After: depends/patches/qt/qdir_temppath.patch
File metadata
new file mode 100644 index 0000000000000000000000000000000000000000..f293b7b3984f24e16a4bbdecd3b3dcb615121f0c
Download original patch · Release notes
Diff rows 1–19 of 19. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.
depends/patches/qt/qdir_temppath.patch
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
--- a/qtbase/src/corelib/io/qfilesystemengine_win.cpp
|
|
2
|
+
+++ b/qtbase/src/corelib/io/qfilesystemengine_win.cpp
|
|
3
|
+
@@ -1390,7 +1390,15 @@
|
|
4
|
+
QString ret;
|
|
5
|
+
#ifndef Q_OS_WINRT
|
|
6
|
+
wchar_t tempPath[MAX_PATH];
|
|
7
|
+
- const DWORD len = GetTempPath(MAX_PATH, tempPath);
|
|
8
|
+
+ using GetTempPathPrototype = DWORD (WINAPI *)(DWORD, LPWSTR);
|
|
9
|
+
+ // We try to resolve GetTempPath2 and use that, otherwise fall back to GetTempPath:
|
|
10
|
+
+ static GetTempPathPrototype getTempPathW = []() {
|
|
11
|
+
+ const HMODULE kernel32 = GetModuleHandleW(L"kernel32.dll");
|
|
12
|
+
+ if (auto *func = QFunctionPointer(GetProcAddress(kernel32, "GetTempPath2W")))
|
|
13
|
+
+ return GetTempPathPrototype(func);
|
|
14
|
+
+ return GetTempPath;
|
|
15
|
+
+ }();
|
|
16
|
+
+ const DWORD len = getTempPathW(MAX_PATH, tempPath);
|
|
17
|
+
if (len) { // GetTempPath() can return short names, expand.
|
|
18
|
+
wchar_t longTempPath[MAX_PATH];
|
|
19
|
+
const DWORD longLen = GetLongPathName(tempPath, longTempPath, MAX_PATH);
|