mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
Use ArgsManager::GetPathArg() for "-walletdir" option
This commit is contained in:
parent
06fed4c21e
commit
ecd094e2b1
3 changed files with 6 additions and 6 deletions
|
@ -28,7 +28,7 @@ bool VerifyWallets(WalletContext& context)
|
|||
ArgsManager& args = *Assert(context.args);
|
||||
|
||||
if (args.IsArgSet("-walletdir")) {
|
||||
fs::path wallet_dir = fs::PathFromString(args.GetArg("-walletdir", ""));
|
||||
const fs::path wallet_dir{args.GetPathArg("-walletdir")};
|
||||
std::error_code error;
|
||||
// The canonical path cleans the path, preventing >1 Berkeley environment instances for the same directory
|
||||
// It also lets the fs::exists and fs::is_directory checks below pass on windows, since they return false
|
||||
|
|
|
@ -18,7 +18,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)
|
|||
SetWalletDir(m_walletdir_path_cases["default"]);
|
||||
bool result = m_wallet_loader->verify();
|
||||
BOOST_CHECK(result == true);
|
||||
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
|
||||
fs::path walletdir = gArgs.GetPathArg("-walletdir");
|
||||
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
|
||||
BOOST_CHECK_EQUAL(walletdir, expected_path);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom)
|
|||
SetWalletDir(m_walletdir_path_cases["custom"]);
|
||||
bool result = m_wallet_loader->verify();
|
||||
BOOST_CHECK(result == true);
|
||||
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
|
||||
fs::path walletdir = gArgs.GetPathArg("-walletdir");
|
||||
fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);
|
||||
BOOST_CHECK_EQUAL(walletdir, expected_path);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing)
|
|||
SetWalletDir(m_walletdir_path_cases["trailing"]);
|
||||
bool result = m_wallet_loader->verify();
|
||||
BOOST_CHECK(result == true);
|
||||
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
|
||||
fs::path walletdir = gArgs.GetPathArg("-walletdir");
|
||||
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
|
||||
BOOST_CHECK_EQUAL(walletdir, expected_path);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2)
|
|||
SetWalletDir(m_walletdir_path_cases["trailing2"]);
|
||||
bool result = m_wallet_loader->verify();
|
||||
BOOST_CHECK(result == true);
|
||||
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
|
||||
fs::path walletdir = gArgs.GetPathArg("-walletdir");
|
||||
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
|
||||
BOOST_CHECK_EQUAL(walletdir, expected_path);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ fs::path GetWalletDir()
|
|||
fs::path path;
|
||||
|
||||
if (gArgs.IsArgSet("-walletdir")) {
|
||||
path = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
|
||||
path = gArgs.GetPathArg("-walletdir");
|
||||
if (!fs::is_directory(path)) {
|
||||
// If the path specified doesn't exist, we return the deliberately
|
||||
// invalid empty string.
|
||||
|
|
Loading…
Add table
Reference in a new issue