Commit b22a27c0 authored by Lisa's avatar Lisa

getPackagesByName now only returns package archives from the caùche (avoids...

getPackagesByName now only returns package archives from the caùche (avoids performing operations destined to fail).
parent d4ae0ba2
......@@ -16,6 +16,7 @@
#include <akabeiconfig.h>
#include <utime.h>
#include <akabeicore/libarchive++/archivehandler.h>
#include <SQLiteConnection.h>
/*
......@@ -165,7 +166,7 @@ QStringList Cache::getPackagesByName(const QString &pkg) const
QStringList matches;
foreach (QString const& file, d->plainEntryList) {
if (d->getPackageName(file) == pkg) {
if (d->getPackageName(file) == pkg && file.endsWith(Akabei::packageExtension)) {
matches.append(d->cachedir.absoluteFilePath(file));
}
}
......
......@@ -80,10 +80,10 @@ public:
QString getPathInCache(const QString &filename) const;
/**
* Find a list of files in cache. Useful when you don't care about the version.
* Find package files in cache. Useful when you don't care about the version.
*
* @param pkg the name of the package to find.
* @returns a list of files with that package name.
* @returns a list of files corresponding to the available versions of the desired package.
*/
QStringList getPackagesByName(const QString &pkg) const;
......
......@@ -129,6 +129,8 @@ const QUrl DEFAULT_DATABASE_DIR("/var/lib/akabei");
const QUrl DEFAULT_CACHE_DIR("/var/cache/akabei/pkg");
const QString errorPrefix = ":: ";
const QString packageExtension = ".tar.xz";
const QString signatureExtension = ".sig";
enum ProcessingOption
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment