MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / GetDefaultDataDir

Function GetDefaultDataDir

src/util.cpp:450–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450boost::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
479static boost::filesystem::path pathCached;
480static boost::filesystem::path pathCachedNetSpecific;

Callers 3

AppInit2Function · 0.85
util.cppFile · 0.85

Calls 2

GetSpecialFolderPathFunction · 0.85
TryCreateDirectoryFunction · 0.85

Tested by

no test coverage detected