bool Package::hasValidStructure() const

needed to differentiate between packages with structures and without
before path is set
This commit is contained in:
Aaron Seigo 2014-08-08 14:11:50 +02:00
parent 3e61b26178
commit 928d5e63a5
3 changed files with 14 additions and 1 deletions

View File

@ -72,6 +72,11 @@ Package &Package::operator=(const Package &rhs)
return *this;
}
bool Package::hasValidStructure() const
{
return d->structure;
}
bool Package::isValid() const
{
if (!d->structure) {

View File

@ -101,6 +101,14 @@ public:
*/
Package &operator=(const Package &rhs);
/**
* @return true if this package has a valid PackageStructure associatedw it with it.
* A package may not be valid, but have a valid structure. Useful when dealing with
* Package objects in a semi-initialized state (e.g. before calling setPath())
* @since 5.1
*/
bool hasValidStructure() const;
/**
* @return true if all the required components exist
**/

View File

@ -399,7 +399,7 @@ Package PluginLoader::loadPackage(const QString &packageFormat, const QString &s
{
if (!d->isDefaultLoader) {
Package p = internalLoadPackage(packageFormat, specialization);
if (p.isValid() || !p.files().isEmpty()) {
if (p.hasValidStructure()) {
return p;
}
}