diff options
author | Gatis Paeglis <gatis.paeglis@digia.com> | 2013-01-02 16:50:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-14 23:44:15 +0100 |
commit | 18c916517f3004d34482c20ed66bf09ec274d385 (patch) | |
tree | 9585dfd143f38480af85001f978c230ceaccc90d /src/plugins/platforms | |
parent | d4adcfb8cc1b22d85641d7e4aa03b67850a4c715 (diff) |
Use backslashes for UNC paths.
ShellExecute fails to open a share folder due to using '/' instead of '\'.
Windows API doesn't support forward slashes for extended-length path.
Extended-length path are path that start with a "\\?\" prefix. For example,
"\\?\c:\very_long_path\foo\bar.txt", or in the case of a UNC path that
would be "\\?\very_long_path\foo\bar.txt". [1]
[1] http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx#maxpath
Task-number: QTBUG-13359
Change-Id: Ibb113abeebd56f106f76520bc23dba797de548fa
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsservices.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 3121d5c869..cd446efc62 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -44,6 +44,7 @@ #include <QtCore/QUrl> #include <QtCore/QDebug> +#include <QtCore/QDir> #include <shlobj.h> #ifndef Q_OS_WINCE @@ -57,7 +58,8 @@ enum { debug = 0 }; static inline bool shellExecute(const QString &file) { #ifndef Q_OS_WINCE - const quintptr result = (quintptr)ShellExecute(0, 0, (wchar_t*)file.utf16(), 0, 0, SW_SHOWNORMAL); + const QString nativeFilePath = QDir::toNativeSeparators(file); + const quintptr result = (quintptr)ShellExecute(0, 0, (wchar_t*)nativeFilePath.utf16(), 0, 0, SW_SHOWNORMAL); // ShellExecute returns a value greater than 32 if successful if (result <= 32) { qWarning("ShellExecute '%s' failed (error %s).", qPrintable(file), qPrintable(QString::number(result))); |