diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-07-02 01:57:58 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-07-02 01:57:58 (GMT) |
commit | 00dedffa8ad1fdec14e9e0a9184f49343c42c846 (patch) | |
tree | a5afed25c0d996e387809d5b409c3025256976f8 /src/declarative/qml | |
parent | 092e530f2cd5357774c0bc7d09b453250be3fa74 (diff) | |
download | Qt-00dedffa8ad1fdec14e9e0a9184f49343c42c846.zip Qt-00dedffa8ad1fdec14e9e0a9184f49343c42c846.tar.gz Qt-00dedffa8ad1fdec14e9e0a9184f49343c42c846.tar.bz2 |
Don't accept *files* that exist when *directory* is required.
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativeimport.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/declarative/qml/qdeclarativeimport.cpp b/src/declarative/qml/qdeclarativeimport.cpp index a2e3831..fe05d20 100644 --- a/src/declarative/qml/qdeclarativeimport.cpp +++ b/src/declarative/qml/qdeclarativeimport.cpp @@ -409,7 +409,8 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp QString localFileOrQrc = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(importUrl); if (!localFileOrQrc.isEmpty()) { QString dir = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(base.resolved(QUrl(uri))); - if (dir.isEmpty() || !QDir().exists(dir)) { + QFileInfo dirinfo(dir); + if (dir.isEmpty() || !dirinfo.exists() || !dirinfo.isDir()) { if (errorString) *errorString = QDeclarativeImportDatabase::tr("\"%1\": no such directory").arg(uri_arg); return false; // local import dirs must exist @@ -425,7 +426,8 @@ bool QDeclarativeImportsPrivate::add(const QDeclarativeDirComponents &qmldircomp if (prefix.isEmpty()) { // directory must at least exist for valid import QString localFileOrQrc = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(base.resolved(QUrl(uri))); - if (localFileOrQrc.isEmpty() || !QDir().exists(localFileOrQrc)) { + QFileInfo dirinfo(localFileOrQrc); + if (localFileOrQrc.isEmpty() || !dirinfo.exists() || !dirinfo.isDir()) { if (errorString) { if (localFileOrQrc.isEmpty()) *errorString = QDeclarativeImportDatabase::tr("import \"%1\" has no qmldir and no namespace").arg(uri); |