Skip to content

Commit

Permalink
PackageJobThread: Also check if metadata.json file exists
Browse files Browse the repository at this point in the history
When we update a package, there can be metadata.json file.
It seems like this was just forgotten when the metadata.json checks
were added elsewhere.
  • Loading branch information
alex1701c committed Mar 21, 2022
1 parent 3f52af7 commit 57ba435
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/kpackage/private/packagejobthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ bool PackageJobThread::installPackage(const QString &src, const QString &dest, O

if (QFile::exists(targetName)) {
if (operation == Update) {
KPluginMetaData oldMeta(targetName + QLatin1String("/metadata.desktop"));
KPluginMetaData oldMeta;
if (QFileInfo::exists(targetName + QLatin1String("/metadata.desktop"))) {
oldMeta = KPluginMetaData::fromDesktopFile(targetName + QLatin1String("/metadata.desktop"));
} else if (QFileInfo::exists(targetName + QLatin1String("/metadata.json"))) {
oldMeta = KPluginMetaData::fromJsonFile(targetName + QLatin1String("/metadata.json"));
}

if (readKPackageTypes(oldMeta) != readKPackageTypes(meta)) {
d->errorMessage = i18n("The new package has a different type from the old version already installed.");
Expand Down

0 comments on commit 57ba435

Please sign in to comment.