From ddf0dd87344d68e1f9a768c188c43fc4aa80b7bf Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 28 May 2019 16:55:43 +0200 Subject: Utils: Add a FilePath::isDir() convenience function Change-Id: I1df0ee1b136299ae6e4f2e5bd0bdc24bfeca33dd Reviewed-by: Eike Ziller --- src/libs/utils/fileutils.cpp | 6 ++++++ src/libs/utils/fileutils.h | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libs') diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index e4d303659f..8608756627 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -936,6 +936,12 @@ bool FilePath::isLocal() const return m_url.isEmpty() || m_url.isLocalFile(); } +bool FilePath::isDir() const +{ + QTC_CHECK(m_url.isEmpty()); // FIXME: Not implemented yet. + return QFileInfo(m_data).isDir(); +} + /// \returns the relativeChildPath of FilePath to parent if FilePath is a child of parent /// \note returns a empty FilePath if FilePath is not a child of parent /// That is, this never returns a path starting with "../" diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index 224ef7730e..2026ad1068 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -98,8 +98,9 @@ public: bool isChildOf(const FilePath &s) const; bool isChildOf(const QDir &dir) const; bool endsWith(const QString &s) const; - bool isLocal() const; + bool isLocal() const; + bool isDir() const; bool isNewerThan(const QDateTime &timeStamp) const; FilePath relativeChildPath(const FilePath &parent) const; -- cgit v1.2.1