Recognize UNC paths as absolute (i.e. not relative)

IoUtils::isRelativePath() didn't attempt to consider UNC paths, due to
a belief that qmake fails on them so badly that it wasn't worth the
extra code.  However, it turns out Qt Creator's copy of this code does
need to take this into account, so start the change off in qmake's
version so as to keep in sync.

This is a cherry pick from qtbase commit 4b4a288f5f88077d647d47e9bdd911edf6cdca72

Fixes: QTCREATORBUG-21881
Written-by: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I3084b87c1d3ca6508255e94e04ac8db3ceaebb7e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-02-04 09:35:32 +01:00
parent 4e2c3a7d72
commit 2e58938404

View File

@@ -75,7 +75,12 @@ bool IoUtils::isRelativePath(const QString &path)
&& (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) {
return false;
}
// (... unless, of course, they're UNC, which qmake fails on anyway)
// ... unless, of course, they're UNC:
if (path.length() >= 2
&& (path.at(0).unicode() == '\\' || path.at(0).unicode() == '/')
&& path.at(1) == path.at(0)) {
return false;
}
#else
if (path.startsWith(QLatin1Char('/')))
return false;