From bbf7e910ecea18df2fa362c43405ed4a64f8b75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Mon, 18 Feb 2013 04:08:00 +0100 Subject: [PATCH] Fix loading plugininfo from file Remove trailing slash from the path as it might point to a file, in which case the file info lookup will fail. --- src/plasma/package.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plasma/package.cpp b/src/plasma/package.cpp index 07b4a9c54..e4dd75b59 100644 --- a/src/plasma/package.cpp +++ b/src/plasma/package.cpp @@ -201,14 +201,21 @@ KPluginInfo Package::metadata() const if (!metadataPath.isEmpty()) { d->createPackageMetadata(metadataPath); } else { - QFileInfo fileInfo(d->path); + // d->path might still be a file, if its path has a trailing /, + // the fileInfo lookup will fail, so remove it. + QString p = d->path; + if (d->path.endsWith("/")) { + p = p.remove(p.count()-1, 1); + } + d->path = p; + QFileInfo fileInfo(p); if (fileInfo.isDir()) { d->createPackageMetadata(d->path); } else if (fileInfo.exists()) { KArchive *archive = 0; QMimeDatabase db; - QMimeType mimeType = db.mimeTypeForFile(d->path); + QMimeType mimeType = db.mimeTypeForFile(p); if (mimeType.inherits("application/zip")) { archive = new KZip(d->path);