| 448 | } |
| 449 | |
| 450 | boost::filesystem::path GetDefaultDataDir() |
| 451 | { |
| 452 | namespace fs = boost::filesystem; |
| 453 | // Windows < Vista: C:\Documents and Settings\Username\Application Data\Bitcoin |
| 454 | // Windows >= Vista: C:\Users\Username\AppData\Roaming\Bitcoin |
| 455 | // Mac: ~/Library/Application Support/Bitcoin |
| 456 | // Unix: ~/.bitcoin |
| 457 | #ifdef WIN32 |
| 458 | // Windows |
| 459 | return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin"; |
| 460 | #else |
| 461 | fs::path pathRet; |
| 462 | char* pszHome = getenv("HOME"); |
| 463 | if (pszHome == NULL || strlen(pszHome) == 0) |
| 464 | pathRet = fs::path("/"); |
| 465 | else |
| 466 | pathRet = fs::path(pszHome); |
| 467 | #ifdef MAC_OSX |
| 468 | // Mac |
| 469 | pathRet /= "Library/Application Support"; |
| 470 | TryCreateDirectory(pathRet); |
| 471 | return pathRet / "Bitcoin"; |
| 472 | #else |
| 473 | // Unix |
| 474 | return pathRet / ".bitcoin"; |
| 475 | #endif |
| 476 | #endif |
| 477 | } |
| 478 | |
| 479 | static boost::filesystem::path pathCached; |
| 480 | static boost::filesystem::path pathCachedNetSpecific; |
no test coverage detected