Skip to content

Commit ecd094e

Browse files
committed
Use ArgsManager::GetPathArg() for "-walletdir" option
1 parent 06fed4c commit ecd094e

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/wallet/load.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ bool VerifyWallets(WalletContext& context)
2828
ArgsManager& args = *Assert(context.args);
2929

3030
if (args.IsArgSet("-walletdir")) {
31-
fs::path wallet_dir = fs::PathFromString(args.GetArg("-walletdir", ""));
31+
const fs::path wallet_dir{args.GetPathArg("-walletdir")};
3232
std::error_code error;
3333
// The canonical path cleans the path, preventing >1 Berkeley environment instances for the same directory
3434
// It also lets the fs::exists and fs::is_directory checks below pass on windows, since they return false

src/wallet/test/init_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_default)
1818
SetWalletDir(m_walletdir_path_cases["default"]);
1919
bool result = m_wallet_loader->verify();
2020
BOOST_CHECK(result == true);
21-
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
21+
fs::path walletdir = gArgs.GetPathArg("-walletdir");
2222
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
2323
BOOST_CHECK_EQUAL(walletdir, expected_path);
2424
}
@@ -28,7 +28,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_custom)
2828
SetWalletDir(m_walletdir_path_cases["custom"]);
2929
bool result = m_wallet_loader->verify();
3030
BOOST_CHECK(result == true);
31-
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
31+
fs::path walletdir = gArgs.GetPathArg("-walletdir");
3232
fs::path expected_path = fs::canonical(m_walletdir_path_cases["custom"]);
3333
BOOST_CHECK_EQUAL(walletdir, expected_path);
3434
}
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing)
6868
SetWalletDir(m_walletdir_path_cases["trailing"]);
6969
bool result = m_wallet_loader->verify();
7070
BOOST_CHECK(result == true);
71-
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
71+
fs::path walletdir = gArgs.GetPathArg("-walletdir");
7272
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
7373
BOOST_CHECK_EQUAL(walletdir, expected_path);
7474
}
@@ -78,7 +78,7 @@ BOOST_AUTO_TEST_CASE(walletinit_verify_walletdir_no_trailing2)
7878
SetWalletDir(m_walletdir_path_cases["trailing2"]);
7979
bool result = m_wallet_loader->verify();
8080
BOOST_CHECK(result == true);
81-
fs::path walletdir = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
81+
fs::path walletdir = gArgs.GetPathArg("-walletdir");
8282
fs::path expected_path = fs::canonical(m_walletdir_path_cases["default"]);
8383
BOOST_CHECK_EQUAL(walletdir, expected_path);
8484
}

src/wallet/walletutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fs::path GetWalletDir()
1313
fs::path path;
1414

1515
if (gArgs.IsArgSet("-walletdir")) {
16-
path = fs::PathFromString(gArgs.GetArg("-walletdir", ""));
16+
path = gArgs.GetPathArg("-walletdir");
1717
if (!fs::is_directory(path)) {
1818
// If the path specified doesn't exist, we return the deliberately
1919
// invalid empty string.

0 commit comments

Comments
 (0)