aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorJames O'Beirne <james.obeirne@gmail.com>2018-01-30 22:33:49 -0500
committerJames O'Beirne <james.obeirne@gmail.com>2018-02-05 17:48:59 -0500
commit54604600c3de6cb18540c0911127173f68ad246c (patch)
treeb778b12ff044d505836aac17225354451e950515 /src/util.h
parenta1e13055c2c57913d8d57ca0978cef2fec1e6148 (diff)
downloadbitcoin-54604600c3de6cb18540c0911127173f68ad246c.tar.xz
Add AbsPathForConfigVal to consolidate datadir prefixing for path args
Most commandline/config args are interpreted as relative to datadir if not passed absolute. Consolidate the logic for this normalization.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 277b4c66af..05138a9bfe 100644
--- a/src/util.h
+++ b/src/util.h
@@ -191,6 +191,16 @@ bool OpenDebugLog();
void ShrinkDebugFile();
void runCommand(const std::string& strCommand);
+/**
+ * Most paths passed as configuration arguments are treated as relative to
+ * the datadir if they are not absolute.
+ *
+ * @param path The path to be conditionally prefixed with datadir.
+ * @param net_specific Forwarded to GetDataDir().
+ * @return The normalized path.
+ */
+fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true);
+
inline bool IsSwitchChar(char c)
{
#ifdef WIN32