aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/walletutil.cpp
diff options
context:
space:
mode:
authorMeshCollider <dobsonsa68@gmail.com>2017-10-09 09:48:07 +1300
committerMeshCollider <dobsonsa68@gmail.com>2017-11-18 00:50:58 +1300
commit0530ba0eae147563921b162ed05347234d8b53c0 (patch)
tree40d494bbef4a50def396d325004aa69bc6ddda01 /src/wallet/walletutil.cpp
parent99bc0b428b03b571afbc311b7f18fd3a707ac5af (diff)
Add -walletdir parameter to specify custom wallet dir
Diffstat (limited to 'src/wallet/walletutil.cpp')
-rw-r--r--src/wallet/walletutil.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/wallet/walletutil.cpp b/src/wallet/walletutil.cpp
new file mode 100644
index 0000000000..85ac428b25
--- /dev/null
+++ b/src/wallet/walletutil.cpp
@@ -0,0 +1,23 @@
+// Copyright (c) 2017 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include "wallet/walletutil.h"
+
+fs::path GetWalletDir()
+{
+ fs::path path;
+
+ if (gArgs.IsArgSet("-walletdir")) {
+ path = fs::system_complete(gArgs.GetArg("-walletdir", ""));
+ if (!fs::is_directory(path)) {
+ // If the path specified doesn't exist, we return the deliberately
+ // invalid empty string.
+ path = "";
+ }
+ } else {
+ path = GetDataDir();
+ }
+
+ return path;
+}