Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2018-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <common/args.h>6#include <univalue.h>7#include <util/chaintype.h>8#include <util/check.h>9#include <util/fs.h>11#include <fstream>12#include <string>14#include <wallet/test/init_test_fixture.h>16namespace wallet {17InitWalletDirTestingSetup::InitWalletDirTestingSetup(const ChainType chainType) : BasicTestingSetup(chainType)18{19m_wallet_loader = MakeWalletLoader(*m_node.chain, m_args);21const auto sep = fs::path::preferred_separator;23m_datadir = m_args.GetDataDirNet();24m_cwd = fs::current_path();26m_walletdir_path_cases["default"] = m_datadir / "wallets";27m_walletdir_path_cases["custom"] = m_datadir / "my_wallets";28m_walletdir_path_cases["nonexistent"] = m_datadir / "path_does_not_exist";29m_walletdir_path_cases["file"] = m_datadir / "not_a_directory.dat";30m_walletdir_path_cases["trailing"] = (m_datadir / "wallets") + sep;31m_walletdir_path_cases["trailing2"] = (m_datadir / "wallets") + sep + sep;33fs::current_path(m_datadir);34m_walletdir_path_cases["relative"] = "wallets";36fs::create_directories(m_walletdir_path_cases["default"]);37fs::create_directories(m_walletdir_path_cases["custom"]);38fs::create_directories(m_walletdir_path_cases["relative"]);39std::ofstream f{m_walletdir_path_cases["file"].std_path()};40f.close();41}43InitWalletDirTestingSetup::~InitWalletDirTestingSetup()44{45fs::current_path(m_cwd);46}48void InitWalletDirTestingSetup::SetWalletDir(const fs::path& walletdir_path)49{50m_args.ForceSetArg("-walletdir", fs::PathToString(walletdir_path));51}52} // namespace wallet
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.