MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / SetupConfigurationDirectory

Method SetupConfigurationDirectory

ResourceManager.cpp:511–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509}
510
511void ResourceManager::SetupConfigurationDirectory()
512{
513 config_dir.clear();
514#ifdef _WIN32
515 const wchar_t* appdata = _wgetenv(L"APPDATA");
516 if(appdata != NULL)
517 {
518 config_dir = appdata;
519 }
520#else
521 const char* xdg_config_home = getenv("XDG_CONFIG_HOME");
522 const char* home = getenv("HOME");
523 /*-----------------------------------------------------*\
524 | Check both XDG_CONFIG_HOME and APPDATA environment |
525 | variables. If neither exist, use current directory |
526 \*-----------------------------------------------------*/
527 if(xdg_config_home != NULL)
528 {
529 config_dir = xdg_config_home;
530 }
531 else if(home != NULL)
532 {
533 config_dir = home;
534 config_dir /= ".config";
535 }
536#endif
537
538
539 /*-----------------------------------------------------*\
540 | If a configuration directory was found, append OpenRGB|
541 \*-----------------------------------------------------*/
542 if(config_dir != "")
543 {
544 config_dir.append("OpenRGB");
545
546 /*-------------------------------------------------------------------------*\
547 | Create OpenRGB configuration directory if it doesn't exist |
548 \*-------------------------------------------------------------------------*/
549 filesystem::create_directories(config_dir);
550 }
551 else
552 {
553 config_dir = "./";
554 }
555}
556
557filesystem::path ResourceManager::GetConfigurationDirectory()
558{

Callers

nothing calls this directly

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected