| 333 | } |
| 334 | |
| 335 | fs::path ArgsManager::GetDataDir(bool net_specific) const |
| 336 | { |
| 337 | AssertLockHeld(cs_args); |
| 338 | fs::path& path = net_specific ? m_cached_network_datadir_path : m_cached_datadir_path; |
| 339 | |
| 340 | // Used cached path if available |
| 341 | if (!path.empty()) return path; |
| 342 | |
| 343 | const fs::path datadir{GetPathArg_("-datadir")}; |
| 344 | if (!datadir.empty()) { |
| 345 | path = fs::absolute(datadir); |
| 346 | if (!fs::is_directory(path)) { |
| 347 | path = ""; |
| 348 | return path; |
| 349 | } |
| 350 | } else { |
| 351 | path = GetDefaultDataDir(); |
| 352 | } |
| 353 | |
| 354 | if (net_specific && !BaseParams().DataDir().empty()) { |
| 355 | path /= fs::PathFromString(BaseParams().DataDir()); |
| 356 | } |
| 357 | |
| 358 | return path; |
| 359 | } |
| 360 | |
| 361 | void ArgsManager::ClearPathCache() |
| 362 | { |
nothing calls this directly
no outgoing calls
no test coverage detected