2018-07-27 00:36:45 +02:00
|
|
|
// Copyright (c) 2017-2018 The Bitcoin Core developers
|
2017-10-08 22:48:07 +02:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2017-11-18 01:36:37 +01:00
|
|
|
#include <wallet/walletutil.h>
|
2017-10-08 22:48:07 +02:00
|
|
|
|
|
|
|
fs::path GetWalletDir()
|
|
|
|
{
|
|
|
|
fs::path path;
|
|
|
|
|
|
|
|
if (gArgs.IsArgSet("-walletdir")) {
|
2018-01-18 19:15:00 +01:00
|
|
|
path = gArgs.GetArg("-walletdir", "");
|
2017-10-08 22:48:07 +02:00
|
|
|
if (!fs::is_directory(path)) {
|
|
|
|
// If the path specified doesn't exist, we return the deliberately
|
|
|
|
// invalid empty string.
|
|
|
|
path = "";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
path = GetDataDir();
|
2017-10-27 04:15:40 +02:00
|
|
|
// If a wallets directory exists, use that, otherwise default to GetDataDir
|
|
|
|
if (fs::is_directory(path / "wallets")) {
|
|
|
|
path /= "wallets";
|
|
|
|
}
|
2017-10-08 22:48:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return path;
|
|
|
|
}
|