fix resolution of paths w/ only a packageRoot+name

This commit is contained in:
Marco Martin 2011-07-14 14:53:57 +02:00
parent ecc8692c33
commit 14c3235a17
3 changed files with 18 additions and 2 deletions

View File

@ -128,7 +128,7 @@ Package::Package()
Package::Package(const QString &packageRoot, const QString &package,
PackageStructure::Ptr structure)
: d(new PackagePrivate(structure, packageRoot + '/' + package))
: d(new PackagePrivate(structure, packageRoot, package))
{
}
@ -767,6 +767,21 @@ PackagePrivate::PackagePrivate(const PackageStructure::Ptr st, const QString &p)
valid = structure && !structure->path().isEmpty();
}
PackagePrivate::PackagePrivate(const PackageStructure::Ptr st, const QString &packageRoot, const QString &path)
: structure(st),
service(0)
{
if (structure) {
if (packageRoot.isEmpty()) {
structure->setPath(structure->defaultPackageRoot()%"/"%path);
} else {
structure->setPath(packageRoot%path);
}
}
valid = structure && !structure->path().isEmpty();
}
PackagePrivate::PackagePrivate(const PackagePrivate &other)
: structure(other.structure),
service(other.service),

View File

@ -148,7 +148,7 @@ PackageStructure::Ptr PackageStructure::load(const QString &packageFormat)
} else if (packageFormat == "Plasma/Generic") {
structure = defaultPackageStructure(GenericComponent);
structure->d->type = "Plasma/Generic";
structure->setDefaultPackageRoot(KStandardDirs::locate("data", "plasmapackages"));
structure->setDefaultPackageRoot(KStandardDirs::locate("data", "plasma/packages/"));
}
if (structure) {

View File

@ -32,6 +32,7 @@ class PackagePrivate
{
public:
PackagePrivate(const PackageStructure::Ptr st, const QString &p);
PackagePrivate(const PackageStructure::Ptr st, const QString &packageRoot, const QString &path);
PackagePrivate(const PackagePrivate &other);
~PackagePrivate();