reapack

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

commit 06420408a92db3cff2a4a3919901fa7f487a45b4
parent c44241ccf89b48d76ac57abc6abfa103f4b6e82c
Author: cfillion <cfillion@users.noreply.github.com>
Date:   Thu, 25 Aug 2016 17:11:17 -0400

task: don't commit install tasks if some files cannot be downloaded

Diffstat:
Msrc/task.cpp | 7++++++-
Msrc/task.hpp | 1+
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/task.cpp b/src/task.cpp @@ -31,7 +31,7 @@ Task::Task(Transaction *tx) : m_tx(tx) InstallTask::InstallTask(const Version *ver, const bool pin, const Registry::Entry &re, Transaction *tx) - : Task(tx), m_version(ver), m_pin(pin), m_oldEntry(move(re)), + : Task(tx), m_version(ver), m_pin(pin), m_oldEntry(move(re)), m_fail(false), m_index(ver->package()->category()->index()->shared_from_this()) { } @@ -97,6 +97,9 @@ void InstallTask::saveSource(Download *dl, const Source *src) void InstallTask::commit() { + if(m_fail) + return; + for(const PathGroup &paths : m_newFiles) { #ifdef _WIN32 // TODO: rename to .old @@ -146,6 +149,8 @@ void InstallTask::rollback() { for(const PathGroup &paths : m_newFiles) FS::removeRecursive(paths.temp); + + m_fail = true; } UninstallTask::UninstallTask(const Registry::Entry &re, Transaction *tx) diff --git a/src/task.hpp b/src/task.hpp @@ -67,6 +67,7 @@ private: const Version *m_version; bool m_pin; Registry::Entry m_oldEntry; + bool m_fail; IndexPtr m_index; // keep in memory std::vector<Registry::File> m_oldFiles; std::vector<PathGroup> m_newFiles;