diff options
author | Jaeyoon Jung <jaeyoon.jung@lge.com> | 2018-02-23 08:56:31 +0900 |
---|---|---|
committer | Dominik Holland <dominik.holland@qt.io> | 2020-06-10 12:51:53 +0200 |
commit | bba1b19a18a04060942e5580e36daccf9c830b61 (patch) | |
tree | 91e53bb6d343a19e890efca9758d0da53f885f57 /src/qml/qml/qqmlengine.cpp | |
parent | 334f8674b25c8086b2cd2660cc159030867c0a00 (diff) |
Fix baseUrl returning an empty url
Do not append the directory separator if the current path is the root
directory. Otherwise it is treated as a remote path incorrectly and an
empty url is returned as a result.
Change-Id: Icc62114702265e9e1b247624370a78999e564d5f
Task-number: QTBUG-83121
Pick-to: 5.15
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlengine.cpp')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 381d934b8b..c63418cb0b 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -1285,7 +1285,9 @@ QUrl QQmlEngine::baseUrl() const { Q_D(const QQmlEngine); if (d->baseUrl.isEmpty()) { - return QUrl::fromLocalFile(QDir::currentPath() + QDir::separator()); + const QString currentPath = QDir::currentPath(); + const QString rootPath = QDir::rootPath(); + return QUrl::fromLocalFile((currentPath == rootPath) ? rootPath : (currentPath + QDir::separator())); } else { return d->baseUrl; } |