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

Function GetDefaultDataDir

src/commons/util/util.cpp:589–615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

587}
588
589boost::filesystem::path GetDefaultDataDir() {
590 namespace fs = boost::filesystem;
591 // Windows < Vista: C:\Documents and Settings\Username\Application Data\Coin
592 // Windows >= Vista: C:\Users\Username\AppData\Roaming\Coin
593 // Mac: ~/Library/Application Support/Coin
594 // Unix: ~/.Coin
595#ifdef WIN32
596 // Windows
597 return GetSpecialFolderPath(CSIDL_APPDATA) / IniCfg().GetCoinName();
598#else
599 fs::path pathRet;
600 char* pszHome = getenv("HOME");
601 if (pszHome == NULL || strlen(pszHome) == 0)
602 pathRet = fs::path("/");
603 else
604 pathRet = fs::path(pszHome);
605#ifdef MAC_OSX
606 // Mac
607 pathRet /= "Library/Application Support";
608 TryCreateDirectory(pathRet);
609 return pathRet / IniCfg().GetCoinName();
610#else
611 // Unix
612 return pathRet / ("." + IniCfg().GetCoinName());
613#endif
614#endif
615}
616
617static boost::filesystem::path pathCached[NULL_NETWORK_TYPE + 1];
618static CCriticalSection csPathCached;

Callers 3

AppInitFunction · 0.85
TestingSetupMethod · 0.85
util.cppFile · 0.85

Calls 4

GetSpecialFolderPathFunction · 0.85
pathClass · 0.85
TryCreateDirectoryFunction · 0.85
GetCoinNameMethod · 0.80

Tested by 1

TestingSetupMethod · 0.68