This commit is contained in:
Zack Middleton 2025-04-27 20:42:12 +00:00 committed by GitHub
commit f4b43dd96d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,8 +79,22 @@ char *Sys_DefaultHomePath(void)
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_MACOSX);
}
#else
char origPath[ MAX_OSPATH ] = { 0 };
if( ( p = getenv( "FLATPAK_ID" ) ) != NULL && *p != '\0' )
{
// don't use original homepath in Flatpak
}
else if( ( p = getenv( "HOME" ) ) != NULL )
{
Com_sprintf(origPath, sizeof(origPath), "%s%c", p, PATH_SEP);
if(com_homepath->string[0])
Q_strcat(origPath, sizeof(origPath), com_homepath->string);
else
Q_strcat(origPath, sizeof(origPath), HOMEPATH_NAME_UNIX);
}
if( ( p = getenv( "XDG_DATA_HOME" ) ) != NULL && *p != '\0' )
{
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
@ -104,15 +118,10 @@ char *Sys_DefaultHomePath(void)
Q_strcat(homePath, sizeof(homePath), dir);
}
}
else if( ( p = getenv( "HOME" ) ) != NULL )
{
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
if(com_homepath->string[0])
Q_strcat(homePath, sizeof(homePath), com_homepath->string);
else
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_UNIX);
if( *homePath == '\0' || ( *origPath != '\0' && access(origPath, F_OK) == 0 && access(homePath, F_OK) < 0 ) )
{
Q_strncpyz(homePath, origPath, sizeof(homePath));
}
#endif
}