aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.h
diff options
context:
space:
mode:
authorKiminuo <kiminuo@protonmail.com>2021-04-08 23:15:01 +0200
committerKiminuo <kiminuo@protonmail.com>2021-04-17 20:09:01 +0200
commit1add318704108faa98f5b1b8e9c96d960e9d23a8 (patch)
tree0f1c4d6c1215508224c2ebbf74f47ded717b594c /src/util/system.h
parent70cdf679f8e665dbdc3301873a0267fe9faa72cd (diff)
downloadbitcoin-1add318704108faa98f5b1b8e9c96d960e9d23a8.tar.xz
Move GetDataDir(fNetSpecific) implementation to ArgsManager.
Diffstat (limited to 'src/util/system.h')
-rw-r--r--src/util/system.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/util/system.h b/src/util/system.h
index 29657e56e2..a49055b891 100644
--- a/src/util/system.h
+++ b/src/util/system.h
@@ -200,6 +200,8 @@ protected:
std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args);
bool m_accept_any_command GUARDED_BY(cs_args){true};
std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args);
+ mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args);
+ mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args);
[[nodiscard]] bool ReadConfigStream(std::istream& stream, const std::string& filepath, std::string& error, bool ignore_invalid_keys = false);
@@ -264,6 +266,20 @@ public:
std::optional<const Command> GetCommand() const;
/**
+ * Get data directory path
+ *
+ * @param net_specific Append network identifier to the returned path
+ * @return Absolute path on success, otherwise an empty path when a non-directory path would be returned
+ * @post Returned directory path is created unless it is empty
+ */
+ const fs::path& GetDataDirPath(bool net_specific = true) const;
+
+ /**
+ * For testing
+ */
+ void ClearDatadirPathCache();
+
+ /**
* Return a vector of strings of the given argument
*
* @param strArg Argument to get (e.g. "-foo")