Skip to content

Commit 4c3a5dc

Browse files
committed
scripted-diff: Replace GetDataDir() calls with gArgs.GetDataDirNet() calls
-BEGIN VERIFY SCRIPT- git ls-files -- 'src' ':(exclude)src/util/system.h' ':(exclude)src/util/system.cpp' | xargs sed -i 's/GetDataDir()/gArgs.GetDataDirNet()/g'; -END VERIFY SCRIPT-
1 parent 13bd8bb commit 4c3a5dc

24 files changed

+43
-43
lines changed

src/addrdb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
4343
std::string tmpfn = strprintf("%s.%04x", prefix, randv);
4444

4545
// open temp output file, and associate with CAutoFile
46-
fs::path pathTmp = GetDataDir() / tmpfn;
46+
fs::path pathTmp = gArgs.GetDataDirNet() / tmpfn;
4747
FILE *file = fsbridge::fopen(pathTmp, "wb");
4848
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
4949
if (fileout.IsNull()) {
@@ -135,7 +135,7 @@ bool CBanDB::Read(banmap_t& banSet)
135135

136136
CAddrDB::CAddrDB()
137137
{
138-
pathAddr = GetDataDir() / "peers.dat";
138+
pathAddr = gArgs.GetDataDirNet() / "peers.dat";
139139
}
140140

141141
bool CAddrDB::Write(const CAddrMan& addr)

src/index/blockfilterindex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ BlockFilterIndex::BlockFilterIndex(BlockFilterType filter_type,
9898
const std::string& filter_name = BlockFilterTypeName(filter_type);
9999
if (filter_name.empty()) throw std::invalid_argument("unknown filter_type");
100100

101-
fs::path path = GetDataDir() / "indexes" / "blockfilter" / filter_name;
101+
fs::path path = gArgs.GetDataDirNet() / "indexes" / "blockfilter" / filter_name;
102102
fs::create_directories(path);
103103

104104
m_name = filter_name + " block filter index";

src/index/coinstatsindex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ std::unique_ptr<CoinStatsIndex> g_coin_stats_index;
9797

9898
CoinStatsIndex::CoinStatsIndex(size_t n_cache_size, bool f_memory, bool f_wipe)
9999
{
100-
fs::path path{GetDataDir() / "indexes" / "coinstats"};
100+
fs::path path{gArgs.GetDataDirNet() / "indexes" / "coinstats"};
101101
fs::create_directories(path);
102102

103103
m_db = std::make_unique<CoinStatsIndex::DB>(path / "db", n_cache_size, f_memory, f_wipe);

src/index/txindex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class TxIndex::DB : public BaseIndex::DB
3737
};
3838

3939
TxIndex::DB::DB(size_t n_cache_size, bool f_memory, bool f_wipe) :
40-
BaseIndex::DB(GetDataDir() / "indexes" / "txindex", n_cache_size, f_memory, f_wipe)
40+
BaseIndex::DB(gArgs.GetDataDirNet() / "indexes" / "txindex", n_cache_size, f_memory, f_wipe)
4141
{}
4242

4343
bool TxIndex::DB::ReadTxPos(const uint256 &txid, CDiskTxPos& pos) const

src/init.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ bool AppInitParameterInteraction(const ArgsManager& args)
10151015
static bool LockDataDirectory(bool probeOnly)
10161016
{
10171017
// Make sure only a single Bitcoin process is using the data directory.
1018-
fs::path datadir = GetDataDir();
1018+
fs::path datadir = gArgs.GetDataDirNet();
10191019
if (!DirIsWritable(datadir)) {
10201020
return InitError(strprintf(_("Cannot write to data directory '%s'; check permissions."), datadir.string()));
10211021
}
@@ -1166,7 +1166,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
11661166
assert(!node.addrman);
11671167
node.addrman = std::make_unique<CAddrMan>();
11681168
assert(!node.banman);
1169-
node.banman = std::make_unique<BanMan>(GetDataDir() / "banlist.dat", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME));
1169+
node.banman = std::make_unique<BanMan>(gArgs.GetDataDirNet() / "banlist.dat", &uiInterface, args.GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME));
11701170
assert(!node.connman);
11711171
node.connman = std::make_unique<CConnman>(GetRand(std::numeric_limits<uint64_t>::max()), GetRand(std::numeric_limits<uint64_t>::max()), *node.addrman, args.GetBoolArg("-networkactive", true));
11721172

@@ -1276,7 +1276,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
12761276
asmap_path = DEFAULT_ASMAP_FILENAME;
12771277
}
12781278
if (!asmap_path.is_absolute()) {
1279-
asmap_path = GetDataDir() / asmap_path;
1279+
asmap_path = gArgs.GetDataDirNet() / asmap_path;
12801280
}
12811281
if (!fs::exists(asmap_path)) {
12821282
InitError(strprintf(_("Could not find asmap file %s"), asmap_path));
@@ -1600,8 +1600,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
16001600

16011601
// ********************************************************* Step 11: import blocks
16021602

1603-
if (!CheckDiskSpace(GetDataDir())) {
1604-
InitError(strprintf(_("Error: Disk space is low for %s"), GetDataDir()));
1603+
if (!CheckDiskSpace(gArgs.GetDataDirNet())) {
1604+
InitError(strprintf(_("Error: Disk space is low for %s"), gArgs.GetDataDirNet()));
16051605
return false;
16061606
}
16071607
if (!CheckDiskSpace(gArgs.GetBlocksDirPath())) {

src/init/common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ bool StartLogging(const ArgsManager& args)
134134
if (!LogInstance().m_log_timestamps)
135135
LogPrintf("Startup time: %s\n", FormatISO8601DateTime(GetTime()));
136136
LogPrintf("Default data directory %s\n", GetDefaultDataDir().string());
137-
LogPrintf("Using data directory %s\n", GetDataDir().string());
137+
LogPrintf("Using data directory %s\n", gArgs.GetDataDirNet().string());
138138

139139
// Only log conf file usage message if conf file actually exists.
140140
fs::path config_file_path = GetConfigFile(args.GetArg("-conf", BITCOIN_CONF_FILENAME));

src/net.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,7 +2461,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
24612461

24622462
proxyType i2p_sam;
24632463
if (GetProxy(NET_I2P, i2p_sam)) {
2464-
m_i2p_sam_session = std::make_unique<i2p::sam::Session>(GetDataDir() / "i2p_private_key",
2464+
m_i2p_sam_session = std::make_unique<i2p::sam::Session>(gArgs.GetDataDirNet() / "i2p_private_key",
24652465
i2p_sam.proxy, &interruptNet);
24662466
}
24672467

@@ -2487,7 +2487,7 @@ bool CConnman::Start(CScheduler& scheduler, const Options& connOptions)
24872487

24882488
if (m_use_addrman_outgoing) {
24892489
// Load addresses from anchors.dat
2490-
m_anchors = ReadAnchors(GetDataDir() / ANCHORS_DATABASE_FILENAME);
2490+
m_anchors = ReadAnchors(gArgs.GetDataDirNet() / ANCHORS_DATABASE_FILENAME);
24912491
if (m_anchors.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) {
24922492
m_anchors.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS);
24932493
}
@@ -2627,7 +2627,7 @@ void CConnman::StopNodes()
26272627
if (anchors_to_dump.size() > MAX_BLOCK_RELAY_ONLY_ANCHORS) {
26282628
anchors_to_dump.resize(MAX_BLOCK_RELAY_ONLY_ANCHORS);
26292629
}
2630-
DumpAnchors(GetDataDir() / ANCHORS_DATABASE_FILENAME, anchors_to_dump);
2630+
DumpAnchors(gArgs.GetDataDirNet() / ANCHORS_DATABASE_FILENAME, anchors_to_dump);
26312631
}
26322632
}
26332633

@@ -3043,7 +3043,7 @@ void CaptureMessage(const CAddress& addr, const std::string& msg_type, const Spa
30433043
std::string clean_addr = addr.ToString();
30443044
std::replace(clean_addr.begin(), clean_addr.end(), ':', '_');
30453045

3046-
fs::path base_path = GetDataDir() / "message_capture" / clean_addr;
3046+
fs::path base_path = gArgs.GetDataDirNet() / "message_capture" / clean_addr;
30473047
fs::create_directories(base_path);
30483048

30493049
fs::path path = base_path / (is_incoming ? "msgs_recv.dat" : "msgs_sent.dat");

src/policy/fees.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ CBlockPolicyEstimator::CBlockPolicyEstimator()
504504
longStats = std::unique_ptr<TxConfirmStats>(new TxConfirmStats(buckets, bucketMap, LONG_BLOCK_PERIODS, LONG_DECAY, LONG_SCALE));
505505

506506
// If the fee estimation file is present, read recorded estimations
507-
fs::path est_filepath = GetDataDir() / FEE_ESTIMATES_FILENAME;
507+
fs::path est_filepath = gArgs.GetDataDirNet() / FEE_ESTIMATES_FILENAME;
508508
CAutoFile est_file(fsbridge::fopen(est_filepath, "rb"), SER_DISK, CLIENT_VERSION);
509509
if (est_file.IsNull() || !Read(est_file)) {
510510
LogPrintf("Failed to read fee estimates from %s. Continue anyway.\n", est_filepath.string());
@@ -864,7 +864,7 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, FeeCalculation
864864
void CBlockPolicyEstimator::Flush() {
865865
FlushUnconfirmed();
866866

867-
fs::path est_filepath = GetDataDir() / FEE_ESTIMATES_FILENAME;
867+
fs::path est_filepath = gArgs.GetDataDirNet() / FEE_ESTIMATES_FILENAME;
868868
CAutoFile est_file(fsbridge::fopen(est_filepath, "wb"), SER_DISK, CLIENT_VERSION);
869869
if (est_file.IsNull() || !Write(est_file)) {
870870
LogPrintf("Failed to write fee estimates to %s. Continue anyway.\n", est_filepath.string());

src/qt/clientmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ QString ClientModel::formatClientStartupTime() const
221221

222222
QString ClientModel::dataDir() const
223223
{
224-
return GUIUtil::boostPathToQString(GetDataDir());
224+
return GUIUtil::boostPathToQString(gArgs.GetDataDirNet());
225225
}
226226

227227
QString ClientModel::blocksDir() const

src/qt/guiutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ void handleCloseWindowShortcut(QWidget* w)
405405

406406
void openDebugLogfile()
407407
{
408-
fs::path pathDebug = GetDataDir() / "debug.log";
408+
fs::path pathDebug = gArgs.GetDataDirNet() / "debug.log";
409409

410410
/* Open debug.log with the associated application */
411411
if (fs::exists(pathDebug))

0 commit comments

Comments
 (0)