mirror of
https://github.com/ioquake/ioq3.git
synced 2025-06-04 10:50:56 +00:00
Merge 5201a07a63
into 10afd421f2
This commit is contained in:
commit
f4b43dd96d
1 changed files with 35 additions and 26 deletions
|
@ -79,40 +79,49 @@ char *Sys_DefaultHomePath(void)
|
||||||
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_MACOSX);
|
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_MACOSX);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
char origPath[ MAX_OSPATH ] = { 0 };
|
||||||
|
|
||||||
if( ( p = getenv( "FLATPAK_ID" ) ) != NULL && *p != '\0' )
|
if( ( p = getenv( "FLATPAK_ID" ) ) != NULL && *p != '\0' )
|
||||||
{
|
{
|
||||||
if( ( p = getenv( "XDG_DATA_HOME" ) ) != NULL && *p != '\0' )
|
// don't use original homepath in Flatpak
|
||||||
{
|
|
||||||
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 )
|
else if( ( p = getenv( "HOME" ) ) != NULL )
|
||||||
{
|
{
|
||||||
Com_sprintf(homePath, sizeof(homePath), "%s%c", p, PATH_SEP);
|
Com_sprintf(origPath, sizeof(origPath), "%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(origPath, sizeof(origPath), com_homepath->string);
|
||||||
else
|
else
|
||||||
Q_strcat(homePath, sizeof(homePath), HOMEPATH_NAME_UNIX);
|
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);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( *homePath == '\0' || ( *origPath != '\0' && access(origPath, F_OK) == 0 && access(homePath, F_OK) < 0 ) )
|
||||||
|
{
|
||||||
|
Q_strncpyz(homePath, origPath, sizeof(homePath));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue