mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-09 23:01:51 +00:00
Use XDG_DATA_HOME for Flatpak
Use XDG_DATA_HOME for Flatpak so that fs_homepath is accessible without special permissions/handling. This changes the home path for Flatpak from ~/.q3a/ to ~/.var/app/org.ioquake3.ioquake3/data/q3a/.
This commit is contained in:
parent
7112bfb77f
commit
118a533cbf
1 changed files with 34 additions and 2 deletions
|
@ -65,10 +65,11 @@ char *Sys_DefaultHomePath(void)
|
||||||
|
|
||||||
if( !*homePath && com_homepath != NULL )
|
if( !*homePath && com_homepath != NULL )
|
||||||
{
|
{
|
||||||
|
#ifdef __APPLE__
|
||||||
if( ( p = getenv( "HOME" ) ) != NULL )
|
if( ( p = getenv( "HOME" ) ) != NULL )
|
||||||
{
|
{
|
||||||
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
|
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
|
||||||
#ifdef __APPLE__
|
|
||||||
Q_strcat(homePath, sizeof(homePath),
|
Q_strcat(homePath, sizeof(homePath),
|
||||||
"Library/Application Support/");
|
"Library/Application Support/");
|
||||||
|
|
||||||
|
@ -76,13 +77,44 @@ char *Sys_DefaultHomePath(void)
|
||||||
Q_strcat(homePath, sizeof(homePath), com_homepath->string);
|
Q_strcat(homePath, sizeof(homePath), com_homepath->string);
|
||||||
else
|
else
|
||||||
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_MACOSX);
|
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_MACOSX);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
if( ( p = getenv( "FLATPAK_ID" ) ) != NULL && *p != '\0' )
|
||||||
|
{
|
||||||
|
if( ( p = getenv( "XDG_DATA_HOME" ) ) != NULL && *p != '\0' )
|
||||||
|
{
|
||||||
|
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
|
||||||
|
}
|
||||||
|
else if( ( p = getenv( "HOME" ) ) != NULL && *p != '\0' )
|
||||||
|
{
|
||||||
|
Com_sprintf(homePath, sizeof(homePath), "%s%c.local%cshare%c", p, PATH_SEP, PATH_SEP, PATH_SEP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( *homePath )
|
||||||
|
{
|
||||||
|
char *dir;
|
||||||
|
|
||||||
|
if(com_homepath->string[0])
|
||||||
|
dir = com_homepath->string;
|
||||||
|
else
|
||||||
|
dir = HOMEPATH_NAME_UNIX;
|
||||||
|
|
||||||
|
if(dir[0] == '.' && dir[1] != '\0')
|
||||||
|
dir++;
|
||||||
|
|
||||||
|
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])
|
if(com_homepath->string[0])
|
||||||
Q_strcat(homePath, sizeof(homePath), com_homepath->string);
|
Q_strcat(homePath, sizeof(homePath), com_homepath->string);
|
||||||
else
|
else
|
||||||
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_UNIX);
|
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_UNIX);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return homePath;
|
return homePath;
|
||||||
|
|
Loading…
Reference in a new issue