summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfilesystemengine_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qfilesystemengine_win.cpp')
-rw-r--r--src/corelib/io/qfilesystemengine_win.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
index 2020e34f93..279918b812 100644
--- a/src/corelib/io/qfilesystemengine_win.cpp
+++ b/src/corelib/io/qfilesystemengine_win.cpp
@@ -310,9 +310,18 @@ static QString readSymLink(const QFileSystemEntry &link)
const wchar_t* PathBuffer = &rdb->SymbolicLinkReparseBuffer.PathBuffer[offset];
result = QString::fromWCharArray(PathBuffer, length);
}
- // cut-off "//?/" and "/??/"
- if (result.size() > 4 && result.at(0) == QLatin1Char('\\') && result.at(2) == QLatin1Char('?') && result.at(3) == QLatin1Char('\\'))
+ // cut-off "\\?\" and "\??\"
+ if (result.size() > 4
+ && result.at(0) == QLatin1Char('\\')
+ && result.at(2) == QLatin1Char('?')
+ && result.at(3) == QLatin1Char('\\')) {
result = result.mid(4);
+ // cut off UNC in addition when the link points at a UNC share
+ // in which case we need to prepend another backslash to get \\server\share
+ if (result.leftRef(3) == QLatin1String("UNC")) {
+ result.replace(0, 3, QLatin1Char('\\'));
+ }
+ }
}
free(rdb);
CloseHandle(handle);