diff options
Diffstat (limited to 'tools/qml')
-rw-r--r-- | tools/qml/main.cpp | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 31fd9b383f..e8a506264c 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -46,7 +46,6 @@ #include <QDir> #include <QFile> #include <QFileInfo> -#include <QRegularExpression> #include <QStringList> #include <QScopedPointer> #include <QDebug> @@ -464,7 +463,7 @@ int main(int argc, char *argv[]) QString dummyDir; //Handle main arguments - QStringList argList = app->arguments(); + const QStringList argList = app->arguments(); for (int i = 1; i < argList.count(); i++) { const QString &arg = argList[i]; if (arg == QLatin1String("-quiet")) @@ -568,29 +567,14 @@ int main(int argc, char *argv[]) loadDummyDataFiles(e, dummyDir); for (const QString &path : qAsConst(files)) { - //QUrl::fromUserInput doesn't treat no scheme as relative file paths -#if QT_CONFIG(regularexpression) - QRegularExpression urlRe("[[:word:]]+://.*"); - if (urlRe.match(path).hasMatch()) { //Treat as a URL - QUrl url = QUrl::fromUserInput(path); - if (verboseMode) - printf("qml: loading %s\n", - qPrintable(url.isLocalFile() - ? QDir::toNativeSeparators(url.toLocalFile()) - : url.toString())); + QUrl url = QUrl::fromUserInput(path, QDir::currentPath()); + if (verboseMode) + printf("qml: loading %s\n", qPrintable(url.toString())); + QByteArray strippedFile; + if (getFileSansBangLine(path, strippedFile)) + e.loadData(strippedFile, e.baseUrl().resolved(url)); //QQmlComponent won't resolve it for us, it doesn't know it's a valid file if we loadData + else //Errors or no bang line e.load(url); - } else -#endif - { //Local file path - if (verboseMode) - printf("qml: loading %s\n", qPrintable(QDir::toNativeSeparators(path))); - - QByteArray strippedFile; - if (getFileSansBangLine(path, strippedFile)) - e.loadData(strippedFile, e.baseUrl().resolved(QUrl::fromLocalFile(path))); //QQmlComponent won't resolve it for us, it doesn't know it's a valid file if we loadData - else //Errors or no bang line - e.load(path); - } } if (lw->earlyExit) |