Use $HOME variable if it exists #8

Merged
soutade merged 1 commits from ismail/libgourou:master into master 2024-09-22 10:56:09 +02:00
Showing only changes of commit a1c754d81e - Show all commits

View File

@ -859,14 +859,21 @@ namespace gourou
std::string DRMProcessor::getDefaultAdeptDir(void) std::string DRMProcessor::getDefaultAdeptDir(void)
{ {
#ifndef DEFAULT_ADEPT_DIR #ifndef DEFAULT_ADEPT_DIR
const char* user = getenv("USER"); const char* home = getenv("HOME");
if (home)
return home + std::string("/.config/adept/");
else
{
const char* user = getenv("USER");
if (user && user[0]) if (user && user[0])
{ {
return std::string("/home/") + user + std::string("/.config/adept/"); return std::string("/home/") + user + std::string("/.config/adept/");
} }
else else
return LOCAL_ADEPT_DIR; return LOCAL_ADEPT_DIR;
}
#else #else
return DEFAULT_ADEPT_DIR "/"; return DEFAULT_ADEPT_DIR "/";
#endif #endif