packagefs: Directories with more attributes take precedence over ones with less.
This still preserves the behavior that system packages take precedence over non-system packages. Fixes #10071 (at last.)
This commit is contained in:
parent
abf0c2878a
commit
5301f108ef
@ -5,6 +5,7 @@
|
||||
|
||||
|
||||
#include "PackageDirectory.h"
|
||||
#include "Package.h"
|
||||
|
||||
|
||||
PackageDirectory::PackageDirectory(Package* package, mode_t mode)
|
||||
@ -35,3 +36,22 @@ PackageDirectory::RemoveChild(PackageNode* node)
|
||||
fChildren.Remove(node);
|
||||
node->ReleaseReference();
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PackageDirectory::operator<(const PackageDirectory& other) const
|
||||
{
|
||||
// If one of us has the SYSTEM_PACKAGE flag and the other doesn't,
|
||||
// let PackageNode take care of the comparison.
|
||||
if ((fPackageFlags & BPackageKit::B_PACKAGE_FLAG_SYSTEM_PACKAGE)
|
||||
!= (other.fPackageFlags
|
||||
& BPackageKit::B_PACKAGE_FLAG_SYSTEM_PACKAGE)) {
|
||||
return PackageNode::operator<(other);
|
||||
}
|
||||
|
||||
const int32 attrs = fAttributes.Count(),
|
||||
otherAttrs = other.fAttributes.Count();
|
||||
if (attrs != otherAttrs)
|
||||
return attrs < otherAttrs;
|
||||
return PackageNode::operator<(other);
|
||||
}
|
||||
|
@ -26,6 +26,10 @@ public:
|
||||
const PackageNodeList& Children() const
|
||||
{ return fChildren; }
|
||||
|
||||
bool operator<(const PackageDirectory& other) const;
|
||||
inline bool operator>(const PackageDirectory& other) const
|
||||
{ return other < *this; }
|
||||
|
||||
private:
|
||||
PackageNodeList fChildren;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user