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.

Task-number: QTCREATORBUG-21881
Change-Id: I3084b87c1d3ca6508255e94e04ac8db3ceaebb7e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Edward Welbourne 2019-02-05 10:45:38 +01:00
parent a2c9f9433a
commit 4b4a288f5f

View File

@ -77,7 +77,12 @@ bool IoUtils::isRelativePath(const QString &path)
&& (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) { && (path.at(2) == QLatin1Char('/') || path.at(2) == QLatin1Char('\\'))) {
return false; 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 #else
if (path.startsWith(QLatin1Char('/'))) if (path.startsWith(QLatin1Char('/')))
return false; return false;