| 298 | } |
| 299 | |
| 300 | fs::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 | |
| 325 | fs::path ArgsManager::GetDataDirBase() const { |
| 326 | LOCK(cs_args); |