Don't rely on local pkg dir when reloading library deps

Since 11f1849fde the cache dir is also set as local pkg dir
so we cannot rely on packages really existing there.
This commit is contained in:
Martchus 2022-04-07 21:35:05 +02:00
parent 152ee1dde0
commit 08421fa719
1 changed files with 2 additions and 2 deletions

View File

@ -178,8 +178,8 @@ bool ReloadLibraryDependencies::addRelevantPackage(LibPkg::StorageID packageID,
std::error_code ec;
const auto &fileName = packageInfo->fileName;
const auto &arch = packageInfo->arch;
if (!db->localPkgDir.empty()) {
path = db->localPkgDir % '/' + fileName;
if (!db->localPkgDir.empty() && std::filesystem::file_size(cachePath = db->localPkgDir % '/' + fileName, ec) && !ec) {
path = std::move(cachePath);
} else if (std::filesystem::file_size(cachePath = m_cacheDir + fileName, ec) && !ec) {
path = std::move(cachePath);
} else if (std::filesystem::file_size(cachePath = m_cacheDir % arch % '/' + fileName, ec) && !ec) {