MCPcopy Create free account
hub / github.com/ElementsProject/elements / GetMainchainDefaultDataDir

Function GetMainchainDefaultDataDir

src/util/system.cpp:839–862  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

837#endif
838
839fs::path GetMainchainDefaultDataDir()
840{
841 // Windows: C:\Users\Username\AppData\Roaming\Bitcoin
842 // macOS: ~/Library/Application Support/Bitcoin
843 // Unix-like: ~/.bitcoin
844#ifdef WIN32
845 // Windows
846 return GetSpecialFolderPath(CSIDL_APPDATA) / "Bitcoin";
847#else
848 fs::path pathRet;
849 char* pszHome = getenv("HOME");
850 if (pszHome == nullptr || strlen(pszHome) == 0)
851 pathRet = fs::path("/");
852 else
853 pathRet = fs::path(pszHome);
854#ifdef MAC_OSX
855 // macOS
856 return pathRet / "Library/Application Support/Bitcoin";
857#else
858 // Unix-like
859 return pathRet / ".bitcoin";
860#endif
861#endif
862}
863
864bool CheckDataDirOption()
865{

Callers 1

Calls 2

GetSpecialFolderPathFunction · 0.85
pathClass · 0.85

Tested by

no test coverage detected