|
|
|
@ -728,18 +728,17 @@ fs::path GetDefaultDataDir()
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static fs::path g_blocks_path_cached;
|
|
|
|
|
static fs::path g_blocks_path_cache_net_specific;
|
|
|
|
|
static fs::path pathCached;
|
|
|
|
|
static fs::path pathCachedNetSpecific;
|
|
|
|
|
static CCriticalSection csPathCached;
|
|
|
|
|
|
|
|
|
|
const fs::path &GetBlocksDir(bool fNetSpecific)
|
|
|
|
|
const fs::path &GetBlocksDir()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
LOCK(csPathCached);
|
|
|
|
|
|
|
|
|
|
fs::path &path = fNetSpecific ? g_blocks_path_cache_net_specific : g_blocks_path_cached;
|
|
|
|
|
fs::path &path = g_blocks_path_cache_net_specific;
|
|
|
|
|
|
|
|
|
|
// This can be called during exceptions by LogPrintf(), so we cache the
|
|
|
|
|
// value so we don't have to do memory allocations after that.
|
|
|
|
@ -755,9 +754,8 @@ const fs::path &GetBlocksDir(bool fNetSpecific)
|
|
|
|
|
} else {
|
|
|
|
|
path = GetDataDir(false);
|
|
|
|
|
}
|
|
|
|
|
if (fNetSpecific)
|
|
|
|
|
path /= BaseParams().DataDir();
|
|
|
|
|
|
|
|
|
|
path /= BaseParams().DataDir();
|
|
|
|
|
path /= "blocks";
|
|
|
|
|
fs::create_directories(path);
|
|
|
|
|
return path;
|
|
|
|
@ -801,7 +799,6 @@ void ClearDatadirCache()
|
|
|
|
|
|
|
|
|
|
pathCached = fs::path();
|
|
|
|
|
pathCachedNetSpecific = fs::path();
|
|
|
|
|
g_blocks_path_cached = fs::path();
|
|
|
|
|
g_blocks_path_cache_net_specific = fs::path();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|