Adjust to changed QUrl::isRelative() semantics.

Paths with a leading slash were previously considered relative (with
no scheme) but now they aren't.  So take the opportunity to tweak the
path resolution code

Change-Id: I7b02cb85403ebb151dba274db0c05459ef536f18
Reviewed-by: Lev Zelenskiy <lev.zelenskiy@nokia.com>
Reviewed-by: Ling Hu <ling.hu@nokia.com>
This commit is contained in:
Michael Goddard
2012-04-20 15:18:04 +10:00
committed by Qt by Nokia
parent ebe568f2b1
commit e657397f66

View File

@@ -148,12 +148,22 @@ public:
QUrl expandToFullPath(const QUrl& root, const QString& line)
{
// On Linux, backslashes are not converted to forward slashes :/
if (line.startsWith(QLatin1String("//")) || line.startsWith(QLatin1String("\\\\"))) {
// Network share paths are not resolved
return QUrl::fromLocalFile(line);
}
QUrl url(line);
if (url.isRelative()) {
if (url.scheme().isEmpty()) {
// Resolve it relative to root
if (root.isLocalFile())
return root.resolved(QUrl::fromLocalFile(line));
else
return root.resolved(url);
} else if (url.scheme().length() == 1) {
// Assume it's a drive letter for a Windows path
url = QUrl::fromLocalFile(line);
}
return url;