diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-03-26 20:29:29 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-27 10:26:22 +0100 |
commit | 156bb6ed1aafe96a1d5ea85e3ad8445d6e785bcb (patch) | |
tree | a8529bc77d41c128c9d8fef73aeb59fdee823e48 /src/qml/qml/qqmlengine.cpp | |
parent | 34335e81471e2695c74612a15f9e88d5f4e2dd7e (diff) |
Fix build on older MinGW
The correct declaration of the SHGetPathFromIDList symbol is
being used in mingw-w64 as of r6215, which is a v3 snapshot;
until then, SHGetPathFromIDList was declared to use LPITEMIDLIST.
Change-Id: Icc2f7814bad475c9b825f7d70c0ae4da72f471d9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index d927a8c628..d378d77bb0 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -109,7 +109,9 @@ #include <qlibrary.h> #include <windows.h> -#define CSIDL_APPDATA 0x001a // <username>\Application Data +#ifndef CSIDL_APPDATA +# define CSIDL_APPDATA 0x001a // <username>\Application Data +#endif #endif Q_DECLARE_METATYPE(QQmlProperty) @@ -2302,12 +2304,23 @@ static inline QString shellNormalizeFileName(const QString &name) { const QString nativeSeparatorName(QDir::toNativeSeparators(name)); const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(nativeSeparatorName.utf16()); +// The correct declaration of the SHGetPathFromIDList symbol is +// being used in mingw-w64 as of r6215, which is a v3 snapshot. +#if defined(Q_CC_MINGW) && (!defined(__MINGW64_VERSION_MAJOR) || __MINGW64_VERSION_MAJOR < 3) + ITEMIDLIST file; + if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL))) + return name; + TCHAR buffer[MAX_PATH]; + if (!SHGetPathFromIDList(&file, buffer)) + return name; +#else PIDLIST_ABSOLUTE file; if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL))) return name; TCHAR buffer[MAX_PATH]; if (!SHGetPathFromIDList(file, buffer)) return name; +#endif QString canonicalName = QString::fromWCharArray(buffer); // Upper case drive letter if (canonicalName.size() > 2 && canonicalName.at(1) == QLatin1Char(':')) |