reapack

Package manager for REAPER
Log | Files | Refs | Submodules | README | LICENSE

commit fb26c560d72355dd69e16e23f2a122f83fc1b6ab
parent c6118d58bf553306c723253ff474cbf5e7c39cc7
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Sun,  6 Dec 2015 00:42:34 -0500

reinstall missing packages still in the registry

Diffstat:
Msrc/transaction.cpp | 12++++++++++--
Msrc/transaction.hpp | 1+
2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/transaction.cpp b/src/transaction.cpp @@ -72,7 +72,10 @@ void Transaction::prepare() for(Database *db : m_databases) { for(Package *pkg : db->packages()) { - if(m_registry->versionOf(pkg) != pkg->lastVersion()->name()) + bool hasLatest = m_registry->versionOf(pkg) == pkg->lastVersion()->name(); + bool exists = file_exists(installPath(pkg).join().c_str()); + + if(!hasLatest || !exists) m_packages.push_back(pkg); } } @@ -106,7 +109,7 @@ void Transaction::cancel() void Transaction::install(Package *pkg) { const string &url = pkg->lastVersion()->source(0)->url(); - const Path path = m_root + pkg->targetPath(); + const Path path = installPath(pkg); const string dbName = pkg->category()->database()->name(); Download *dl = new Download(dbName + "/" + pkg->name(), url); @@ -137,6 +140,11 @@ void Transaction::install(Package *pkg) dl->onFinish(bind(&Transaction::finish, this)); } +Path Transaction::installPath(Package *pkg) const +{ + return m_root + pkg->targetPath(); +} + void Transaction::finish() { if(!m_queue.empty()) diff --git a/src/transaction.hpp b/src/transaction.hpp @@ -35,6 +35,7 @@ private: void install(Package *); void addError(const std::string &msg, const std::string &title); + Path installPath(Package *) const; Registry *m_registry;