refs #883, utility functions

* get executable names
* containsApplication
This commit is contained in:
Klaus Basan
2017-02-15 03:35:23 +01:00
committed by Mathew Sutcliffe
parent 7bc53ada3e
commit c8c18b0b21
4 changed files with 27 additions and 1 deletions

View File

@@ -13,5 +13,12 @@ namespace BlackMisc
{
CApplicationInfoList::CApplicationInfoList() = default;
CApplicationInfoList::CApplicationInfoList(const CSequence<CApplicationInfo> &other) : CSequence<CApplicationInfo>(other) {}
CApplicationInfoList::CApplicationInfoList(const CSequence<CApplicationInfo> &other) :
CSequence<CApplicationInfo>(other)
{}
bool CApplicationInfoList::containsApplication(CApplicationInfo::Application application) const
{
return this->contains(&CApplicationInfo::application, application);
}
}

View File

@@ -33,6 +33,9 @@ namespace BlackMisc
//! Construct from base class object.
CApplicationInfoList(const CSequence<CApplicationInfo> &other);
//! List containing entry for CApplicationInfo::Application ?
bool containsApplication(CApplicationInfo::Application application) const;
};
}

View File

@@ -306,4 +306,17 @@ namespace BlackMisc
});
return it->filePath();
}
QStringList getSwiftExecutablesImpl()
{
static const QFileInfo mySelf = QFileInfo(QCoreApplication::applicationFilePath()); // path + dir
static const QStringList filter("*." + mySelf.suffix());
return mySelf.dir().entryList(filter);
}
const QStringList &CFileUtils::getSwiftExecutables()
{
static const QStringList executables(getSwiftExecutablesImpl());
return executables;
}
} // ns

View File

@@ -112,6 +112,9 @@ namespace BlackMisc
//! Returns path to the newest file in dir, optionally matching a wildcard, or empty string.
static QString findNewestFile(const QDir &dir, bool recursive, const QStringList &nameFilters = {}, const QStringList &excludeDirectories = {});
//! Get all swift executables
static const QStringList &getSwiftExecutables();
};
} // ns