aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavol Rusnak <pavol@rusnak.io>2022-02-05 19:36:33 +0100
committerPavol Rusnak <pavol@rusnak.io>2022-03-02 12:09:27 +0100
commit60aa179d8f9a675efa2d78eaadc09e3ba450f50f (patch)
tree09daad1356a504a3efeb083d91ca0f6b45dac053
parent5b946edd73640c6ecdfb4cbac1d4351e634678dc (diff)
Use GetPathArg where possible
Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
-rw-r--r--src/bench/bench_bitcoin.cpp4
-rw-r--r--src/init.cpp7
-rw-r--r--src/init/common.cpp2
3 files changed, 5 insertions, 8 deletions
diff --git a/src/bench/bench_bitcoin.cpp b/src/bench/bench_bitcoin.cpp
index 3f8bff4bcf..d6f9c0f8b5 100644
--- a/src/bench/bench_bitcoin.cpp
+++ b/src/bench/bench_bitcoin.cpp
@@ -109,8 +109,8 @@ int main(int argc, char** argv)
args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", ""));
args.is_list_only = argsman.GetBoolArg("-list", false);
args.min_time = std::chrono::milliseconds(argsman.GetIntArg("-min_time", DEFAULT_MIN_TIME_MS));
- args.output_csv = fs::PathFromString(argsman.GetArg("-output_csv", ""));
- args.output_json = fs::PathFromString(argsman.GetArg("-output_json", ""));
+ args.output_csv = argsman.GetPathArg("-output_csv");
+ args.output_json = argsman.GetPathArg("-output_json");
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);
benchmark::BenchRunner::RunAll(args);
diff --git a/src/init.cpp b/src/init.cpp
index 9813a16563..101d20191a 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -135,7 +135,7 @@ static const char* BITCOIN_PID_FILENAME = "bitcoind.pid";
static fs::path GetPidFile(const ArgsManager& args)
{
- return AbsPathForConfigVal(fs::PathFromString(args.GetArg("-pid", BITCOIN_PID_FILENAME)));
+ return AbsPathForConfigVal(args.GetPathArg("-pid", BITCOIN_PID_FILENAME));
}
[[nodiscard]] static bool CreatePidFile(const ArgsManager& args)
@@ -1229,10 +1229,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// Read asmap file if configured
std::vector<bool> asmap;
if (args.IsArgSet("-asmap")) {
- fs::path asmap_path = fs::PathFromString(args.GetArg("-asmap", ""));
- if (asmap_path.empty()) {
- asmap_path = fs::PathFromString(DEFAULT_ASMAP_FILENAME);
- }
+ fs::path asmap_path = args.GetPathArg("-asmap", DEFAULT_ASMAP_FILENAME);
if (!asmap_path.is_absolute()) {
asmap_path = gArgs.GetDataDirNet() / asmap_path;
}
diff --git a/src/init/common.cpp b/src/init/common.cpp
index 38c60366e3..688471b35d 100644
--- a/src/init/common.cpp
+++ b/src/init/common.cpp
@@ -81,7 +81,7 @@ void AddLoggingArgs(ArgsManager& argsman)
void SetLoggingOptions(const ArgsManager& args)
{
LogInstance().m_print_to_file = !args.IsArgNegated("-debuglogfile");
- LogInstance().m_file_path = AbsPathForConfigVal(fs::PathFromString(args.GetArg("-debuglogfile", DEFAULT_DEBUGLOGFILE)));
+ LogInstance().m_file_path = AbsPathForConfigVal(args.GetPathArg("-debuglogfile", DEFAULT_DEBUGLOGFILE));
LogInstance().m_print_to_console = args.GetBoolArg("-printtoconsole", !args.GetBoolArg("-daemon", false));
LogInstance().m_log_timestamps = args.GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
LogInstance().m_log_time_micros = args.GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);