Only search for metadata.desktop when necessary

This commit is contained in:
Sebastian Kügler 2014-02-02 02:25:08 +01:00
parent fa7ae03867
commit 9e491920e5

View File

@ -256,13 +256,15 @@ QString PackagePrivate::unpack(const QString& filePath)
tempRoot = tempdir.path() + '/';
source->copyTo(tempRoot);
// search metadata.desktop, the zip file might have the package contents in a subdirectory
QDir unpackedPath(tempdir.path());
const QStringList &entries = unpackedPath.entryList(QDir::Dirs);
foreach (const QString pack, entries) {
if ((pack != "." && pack != "..") &&
(QFile::exists(unpackedPath.absolutePath()+'/'+pack+"/metadata.desktop"))) {
tempRoot = unpackedPath.absolutePath()+'/'+pack+'/';
if (!QFile::exists(tempdir.path()+"/metadata.desktop")) {
// search metadata.desktop, the zip file might have the package contents in a subdirectory
QDir unpackedPath(tempdir.path());
const QStringList &entries = unpackedPath.entryList(QDir::Dirs);
foreach (const QString pack, entries) {
if ((pack != "." && pack != "..") &&
(QFile::exists(unpackedPath.absolutePath()+'/'+pack+"/metadata.desktop"))) {
tempRoot = unpackedPath.absolutePath()+'/'+pack+'/';
}
}
}