From 39db5a4416a08fa2c6e378c3d2e858cabaa22dcf Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 13 May 2020 15:39:48 -0400 Subject: [PATCH] fixed patcher not working for manual patches --- src/tools/patcher.cpp | 21 ++++++++++++++------- src/tools/tools.h | 3 ++- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/tools/patcher.cpp b/src/tools/patcher.cpp index a40d55b..03f7825 100644 --- a/src/tools/patcher.cpp +++ b/src/tools/patcher.cpp @@ -6,13 +6,14 @@ namespace mob { patcher::patcher() - : basic_process_runner("patch") + : basic_process_runner("patch"), prebuilt_(false) { } patcher& patcher::task(const std::string& name, bool prebuilt) { - patches_ = paths::patches() / name / (prebuilt ? "prebuilt" : "sources"); + task_ = name; + prebuilt_ = prebuilt; return *this; } @@ -30,19 +31,25 @@ patcher& patcher::root(const fs::path& dir) void patcher::do_run() { - if (!fs::exists(patches_)) + const fs::path patches_root = paths::patches() / task_; + + if (!fs::exists(patches_root)) { cx_->trace(context::generic, - "patch directory {} doesn't exist, assuming no patches", patches_); + "patch directory {} doesn't exist, assuming no patches", + patches_root); return; } if (file_.empty()) { - cx_->trace(context::generic, "looking for patches in {}", patches_); + const fs::path patches = + patches_root / (prebuilt_ ? "prebuilt" : "sources"); - for (auto e : fs::directory_iterator(patches_)) + cx_->trace(context::generic, "looking for patches in {}", patches); + + for (auto e : fs::directory_iterator(patches)) { if (!e.is_regular_file()) { @@ -75,7 +82,7 @@ void patcher::do_run() else { cx_->trace(context::generic, "doing manual patch from {}", file_); - do_patch(patches_ / file_); + do_patch(patches_root / file_); } } diff --git a/src/tools/tools.h b/src/tools/tools.h index 3d1cc58..320adbb 100644 --- a/src/tools/tools.h +++ b/src/tools/tools.h @@ -164,7 +164,8 @@ protected: void do_run() override; private: - fs::path patches_; + std::string task_; + bool prebuilt_; fs::path output_; fs::path file_;