MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / GetBlocksDirPath

Method GetBlocksDirPath

src/common/args.cpp:300–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300fs::path ArgsManager::GetBlocksDirPath() const
301{
302 LOCK(cs_args);
303 fs::path& path = m_cached_blocks_path;
304
305 // Cache the path to avoid calling fs::create_directories on every call of
306 // this function
307 if (!path.empty()) return path;
308
309 if (!GetSetting_("-blocksdir").isNull()) {
310 path = fs::absolute(GetPathArg_("-blocksdir"));
311 if (!fs::is_directory(path)) {
312 path = "";
313 return path;
314 }
315 } else {
316 path = GetDataDir(/*net_specific=*/false);
317 }
318
319 path /= fs::PathFromString(BaseParams().DataDir());
320 path /= "blocks";
321 fs::create_directories(path);
322 return path;
323}
324
325fs::path ArgsManager::GetDataDirBase() const {
326 LOCK(cs_args);

Callers 8

LockDirectoriesFunction · 0.80
InitAndLoadChainstateFunction · 0.80
AppInitMainFunction · 0.80
BOOST_AUTO_TEST_CASEFunction · 0.80
SnapshotTestSetupClass · 0.80
ChainTestingSetupMethod · 0.80
blocksDirMethod · 0.80

Calls 4

absoluteFunction · 0.85
PathFromStringFunction · 0.85
isNullMethod · 0.80
emptyMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.64
ChainTestingSetupMethod · 0.64