Use $HOME variable if it exists

Signed-off-by: Ismail Dönmez <ismail@i10z.com>
This commit is contained in:
Ismail Dönmez 2024-09-19 21:35:05 +02:00
parent ce2cf4192a
commit a1c754d81e
Signed by: ismail
SSH Key Fingerprint: SHA256:eqqlJyEjT2ztYsxWLggpL49JL3BNsQWg7bNKS1I89+4

View File

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