Save 1 string construction

We already were constructing the string, no need to do it twice.
This commit is contained in:
Aleix Pol 2015-02-12 16:05:46 +01:00
parent ecf922ab85
commit 4909a2f471

View File

@ -85,9 +85,10 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
//tries to isolate the relative path asked relative to the contentsPrefixPath: like ui/foo.qml
QString relativePath;
foreach (const QString &prefix, m_package.contentsPrefixPaths()) {
if (path.path().startsWith(m_package.path() + prefix)) {
QString root = m_package.path() + prefix;
if (path.path().startsWith(root)) {
//obtain a string in the form ui/foo/bar/baz.qml
relativePath = path.path().mid(QString(m_package.path() + prefix).length());
relativePath = path.path().mid(root.length());
break;
}
}