diff --git a/src/core/conf.cpp b/src/core/conf.cpp index 2c4ba5b..5b9ebf7 100644 --- a/src/core/conf.cpp +++ b/src/core/conf.cpp @@ -1139,7 +1139,7 @@ void init_options( set_special_options(); - auto log_file = conf::log_file(); + auto log_file = conf().global().log_file(); if (log_file.is_relative()) log_file = conf().paths().prefix() / log_file; diff --git a/src/core/conf.h b/src/core/conf.h index bdd3fb2..1638c84 100644 --- a/src/core/conf.h +++ b/src/core/conf.h @@ -37,15 +37,6 @@ public: static std::string version_by_name(std::string_view name); static fs::path tool_by_name(std::string_view name); - static fs::path log_file() { return global_by_name("log_file"); } - static bool redownload() { return bool_global_by_name("redownload"); } - static bool reextract() { return bool_global_by_name("reextract"); } - static bool reconfigure() { return bool_global_by_name("reconfigure"); } - static bool rebuild() { return bool_global_by_name("rebuild"); } - static bool clean() { return bool_global_by_name("clean_task"); } - static bool fetch() { return bool_global_by_name("fetch_task"); } - static bool build() { return bool_global_by_name("build_task"); } - static bool ignore_uncommitted() { return bool_global_by_name("ignore_uncommitted"); @@ -170,6 +161,16 @@ public: bool dry() const; void set_dry(std::string_view s); + + fs::path log_file() const { return get("log_file"); } + + bool redownload() const { return get("redownload"); } + bool reextract() const { return get("reextract"); } + bool reconfigure() const { return get("reconfigure"); } + bool rebuild() const { return get("rebuild"); } + bool clean() const { return get("clean_task"); } + bool fetch() const { return get("fetch_task"); } + bool build() const { return get("build_task"); } }; class conf_transifex : public conf_section diff --git a/src/tasks/sip.cpp b/src/tasks/sip.cpp index 733dbf5..28c0a5d 100644 --- a/src/tasks/sip.cpp +++ b/src/tasks/sip.cpp @@ -107,7 +107,7 @@ void sip::download() { if (fs::exists(download_file())) { - if (conf::redownload()) + if (conf().global().redownload()) { cx().trace(context::redownload, "deleting {}", download_file()); op::delete_file(cx(), download_file(), op::optional); @@ -132,7 +132,7 @@ void sip::generate() if (fs::exists(header)) { - if (conf::rebuild()) + if (conf().global().rebuild()) { cx().trace(context::rebuild, "ignoring {}", header); } diff --git a/src/tasks/task.cpp b/src/tasks/task.cpp index 14b4453..8b5c937 100644 --- a/src/tasks/task.cpp +++ b/src/tasks/task.cpp @@ -554,7 +554,7 @@ void task::join() void task::clean_task() { - if (!conf::clean()) + if (!conf().global().clean()) return; if (!enabled()) @@ -588,7 +588,7 @@ void task::fetch() clean_task(); check_interrupted(); - if (conf::fetch()) + if (conf().global().fetch()) { cx().info(context::generic, "fetching"); do_fetch(); @@ -612,7 +612,7 @@ void task::fetch() void task::build_and_install() { - if (!conf::build()) + if (!conf().global().build()) return; if (!enabled()) @@ -639,17 +639,18 @@ void task::build_and_install() task::clean task::make_clean_flags() const { clean c = clean::nothing; + const auto g = conf().global(); - if (conf::redownload()) + if (g.redownload()) c |= clean::redownload; - if (conf::reextract()) + if (g.reextract()) c |= clean::reextract; - if (conf::reconfigure()) + if (g.reconfigure()) c |= clean::reconfigure; - if (conf::rebuild()) + if (g.rebuild()) c |= clean::rebuild; return c; diff --git a/src/tools/extractor.cpp b/src/tools/extractor.cpp index cdbf901..31f83e5 100644 --- a/src/tools/extractor.cpp +++ b/src/tools/extractor.cpp @@ -38,7 +38,7 @@ void extractor::do_run() } else if (fs::exists(where_)) { - if (conf::reextract()) + if (conf().global().reextract()) { cx().debug(context::reextract, "deleting {}", where_); op::delete_directory(cx(), where_, op::optional); diff --git a/src/utility/fs.cpp b/src/utility/fs.cpp index a39f81a..f37056e 100644 --- a/src/utility/fs.cpp +++ b/src/utility/fs.cpp @@ -99,7 +99,7 @@ bool bypass_file::exists() const { if (fs::exists(file_)) { - if (conf::rebuild()) + if (conf().global().rebuild()) { cx_.trace(context::rebuild, "bypass file {} exists, deleting", file_);