forked from qt-creator/qt-creator
Macros: Add JS:Util.relativeFilePath(path, base)
Task-number: QTCREATORBUG-14562 Change-Id: Ib0c3ea442d7b2c92cedda7a5933ce73c64acc7e2 Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -87,6 +87,11 @@ QString UtilsJsExtension::absoluteFilePath(const QString &in) const
|
|||||||
return fi.absoluteFilePath();
|
return fi.absoluteFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString UtilsJsExtension::relativeFilePath(const QString &path, const QString &base) const
|
||||||
|
{
|
||||||
|
return QDir(base).relativeFilePath(path);
|
||||||
|
}
|
||||||
|
|
||||||
bool UtilsJsExtension::exists(const QString &in) const
|
bool UtilsJsExtension::exists(const QString &in) const
|
||||||
{
|
{
|
||||||
return QFileInfo::exists(in);
|
return QFileInfo::exists(in);
|
||||||
|
@@ -58,6 +58,8 @@ public:
|
|||||||
Q_INVOKABLE QString path(const QString &in) const;
|
Q_INVOKABLE QString path(const QString &in) const;
|
||||||
Q_INVOKABLE QString absoluteFilePath(const QString &in) const;
|
Q_INVOKABLE QString absoluteFilePath(const QString &in) const;
|
||||||
|
|
||||||
|
Q_INVOKABLE QString relativeFilePath(const QString &path, const QString &base) const;
|
||||||
|
|
||||||
// File checks:
|
// File checks:
|
||||||
Q_INVOKABLE bool exists(const QString &in) const;
|
Q_INVOKABLE bool exists(const QString &in) const;
|
||||||
Q_INVOKABLE bool isDirectory(const QString &in) const;
|
Q_INVOKABLE bool isDirectory(const QString &in) const;
|
||||||
|
Reference in New Issue
Block a user