| From d9df0f66c4474890888fa6f0beeca0b2b56d08fe Mon Sep 17 00:00:00 2001 |
| From: Ray Donnelly <mingw.android@gmail.com> |
| Date: Thu, 8 May 2014 12:01:54 +0100 |
| Subject: [PATCH 4/9] add dirExists() fuction |
| |
| --- |
| src/libs/installer/packagemanagercore.cpp | 11 +++++++++++ |
| src/libs/installer/packagemanagercore.h | 1 + |
| 2 files changed, 12 insertions(+) |
| |
| diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp |
| index 2b7ec45..5ef4d7b 100644 |
| --- a/src/libs/installer/packagemanagercore.cpp |
| +++ b/src/libs/installer/packagemanagercore.cpp |
| @@ -812,6 +812,17 @@ QString PackageManagerCore::readFile(const QString &filePath, const QString &cod |
| return stream.readAll(); |
| } |
| |
| +/*! |
| + \qmlmethod boolean QInstaller::dirExists(string dirPath) |
| + |
| + Returns \c true if the \a dirPath exists; otherwise returns \c false. |
| + |
| + */ |
| +bool PackageManagerCore::dirExists(const QString &dirPath) const |
| +{ |
| + return QFileInfo(dirPath).isDir(); |
| +} |
| + |
| // -- QInstaller |
| |
| /*! |
| diff --git a/src/libs/installer/packagemanagercore.h b/src/libs/installer/packagemanagercore.h |
| index f00f33e..3e47573 100644 |
| --- a/src/libs/installer/packagemanagercore.h |
| +++ b/src/libs/installer/packagemanagercore.h |
| @@ -189,6 +189,7 @@ public: |
| |
| Q_INVOKABLE bool isFileExtensionRegistered(const QString &extension) const; |
| Q_INVOKABLE bool fileExists(const QString &filePath) const; |
| + Q_INVOKABLE bool dirExists(const QString &dirPath) const; |
| Q_INVOKABLE QString readFile(const QString &filePath, const QString &codecName) const; |
| |
| public: |
| -- |
| 2.7.0 |
| |