Commit 5d05db8d authored by Tobias Hunger's avatar Tobias Hunger
Browse files

JsExpander: Add methods to test file/directory existence



Change-Id: Ia51b8d47299d855dd11e8bbcb05b22aea875e458
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
parent 6665ace5
......@@ -87,6 +87,21 @@ QString UtilsJsExtension::absoluteFilePath(const QString &in) const
return fi.absoluteFilePath();
}
bool UtilsJsExtension::exists(const QString &in) const
{
return QFileInfo::exists(in);
}
bool UtilsJsExtension::isDirectory(const QString &in) const
{
return QFileInfo(in).isDir();
}
bool UtilsJsExtension::isFile(const QString &in) const
{
return QFileInfo(in).isFile();
}
QString UtilsJsExtension::preferredSuffix(const QString &mimetype) const
{
Utils::MimeDatabase mdb;
......
......@@ -58,6 +58,11 @@ public:
Q_INVOKABLE QString path(const QString &in) const;
Q_INVOKABLE QString absoluteFilePath(const QString &in) const;
// File checks:
Q_INVOKABLE bool exists(const QString &in) const;
Q_INVOKABLE bool isDirectory(const QString &in) const;
Q_INVOKABLE bool isFile(const QString &in) const;
// MimeDB:
Q_INVOKABLE QString preferredSuffix(const QString &mimetype) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment