summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2019-08-23 10:28:46 +0200
committerJörg Bornemann <joerg.bornemann@qt.io>2019-09-18 09:07:43 +0000
commit075ea485c5006c3715e252737adefd074c95f016 (patch)
treea69ee1228519ff76b55277c97d2a739f881388c4
parent12f0e07dfe03ccde4a92e1b6a091784cdca367e7 (diff)
Support paths longer than MAX_PATH
Prepend \\?\ to paths passed to FastFileInfo to enable paths that have more than MAX_PATH characters. Fixes: QTCREATORBUG-22848 Change-Id: I6c7caae226cc1a05e99a97564cf4d4187a074b45 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--changelog.txt1
-rw-r--r--src/jomlib/fastfileinfo.cpp8
2 files changed, 8 insertions, 1 deletions
diff --git a/changelog.txt b/changelog.txt
index 2d5c216..2dd4a65 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -4,6 +4,7 @@ Changes since jom 1.1.3
- Fixed handling of the command line option /j.
- Makefiles that do not contain targets are allowed.
- Fixed handling of macro definitions on the command line (QTCREATORBUG-22176).
+- Enabled usage of paths longer than MAX_PATH (QTCREATORBUG-22848).
Changes since jom 1.1.2
- Removed the /KEEPTEMPFILES option. This option only worked for top-level make
diff --git a/src/jomlib/fastfileinfo.cpp b/src/jomlib/fastfileinfo.cpp
index 928b489..6926a34 100644
--- a/src/jomlib/fastfileinfo.cpp
+++ b/src/jomlib/fastfileinfo.cpp
@@ -26,6 +26,7 @@
#include "fastfileinfo.h"
#include <QtCore/QDebug>
+#include <QtCore/QDir>
#include <QtCore/QHash>
#include <windows.h>
@@ -60,7 +61,12 @@ FastFileInfo::FastFileInfo(const QString &fileName)
if (z(m_attributes)->dwFileAttributes != INVALID_FILE_ATTRIBUTES)
return;
- if (!GetFileAttributesEx(reinterpret_cast<const TCHAR*>(fileName.utf16()),
+ static const QString longPathPrefix = QStringLiteral("\\\\?\\");
+ QString nativeFilePath = QDir::toNativeSeparators(QFileInfo(fileName).absoluteFilePath());
+ if (!nativeFilePath.startsWith(longPathPrefix))
+ nativeFilePath.prepend(longPathPrefix);
+
+ if (!GetFileAttributesEx(reinterpret_cast<const TCHAR*>(nativeFilePath.utf16()),
GetFileExInfoStandard, &m_attributes))
{
z(m_attributes)->dwFileAttributes = INVALID_FILE_ATTRIBUTES;