MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetDefaultDataDir

Function GetDefaultDataDir

src/util.cpp:513–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511}
512
513boost::filesystem::path GetDefaultDataDir()
514{
515 namespace fs = boost::filesystem;
516// Windows < Vista: C:\Documents and Settings\Username\Application Data\LUX
517// Windows >= Vista: C:\Users\Username\AppData\Roaming\LUX
518// Mac: ~/Library/Application Support/LUX
519// Unix: ~/.lux
520#ifdef WIN32
521 // Windows
522 return GetSpecialFolderPath(CSIDL_APPDATA) / "LUX";
523#else
524 fs::path pathRet;
525 char* pszHome = getenv("HOME");
526 if (pszHome == NULL || strlen(pszHome) == 0)
527 pathRet = fs::path("/");
528 else
529 pathRet = fs::path(pszHome);
530#ifdef MAC_OSX
531 // Mac
532 pathRet /= "Library/Application Support";
533 TryCreateDirectory(pathRet);
534 return pathRet / "LUX";
535#else
536 // Unix
537 return pathRet / ".lux";
538#endif
539#endif
540}
541
542static boost::filesystem::path pathCached;
543static 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