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:
committed by
Qt by Nokia
parent
ebe568f2b1
commit
e657397f66
@@ -148,12 +148,22 @@ public:
|
|||||||
|
|
||||||
QUrl expandToFullPath(const QUrl& root, const QString& line)
|
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);
|
QUrl url(line);
|
||||||
if (url.isRelative()) {
|
if (url.scheme().isEmpty()) {
|
||||||
|
// Resolve it relative to root
|
||||||
if (root.isLocalFile())
|
if (root.isLocalFile())
|
||||||
return root.resolved(QUrl::fromLocalFile(line));
|
return root.resolved(QUrl::fromLocalFile(line));
|
||||||
else
|
else
|
||||||
return root.resolved(url);
|
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;
|
return url;
|
||||||
|
|||||||
Reference in New Issue
Block a user