Skip to content

Commit

Permalink
Show fs_homepath in Flatpak missing pk3 error
Browse files Browse the repository at this point in the history
Tell users to copy pk3 files to fs_homepath as fs_basepath is not user
writable.
  • Loading branch information
zturtleman committed Aug 29, 2024
1 parent 118a533 commit a1fe522
Showing 1 changed file with 45 additions and 10 deletions.
55 changes: 45 additions & 10 deletions code/qcommon/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -3529,6 +3529,8 @@ static void FS_CheckPak0( void )
const char *pakBasename;
qboolean founddemo = qfalse;
unsigned int foundPak = 0, foundTA = 0;
qboolean installHome = qfalse;
char *installPath;

for( path = fs_searchpaths; path; path = path->next )
{
Expand Down Expand Up @@ -3658,6 +3660,21 @@ static void FS_CheckPak0( void )
}
}

#ifdef __linux__
{
const char *p;

// Users can't write to the default Flatpak fs_basepath
if( ( p = getenv( "FLATPAK_ID" ) ) != NULL && *p != '\0' )
installHome = qtrue;
}
#endif

if(installHome)
installPath = fs_homepath->string;
else
installPath = fs_basepath->string;

if(!com_standalone->integer && (foundPak & ((1<<NUM_ID_PAKS)-1)) != ((1<<NUM_ID_PAKS)-1))
{
char errorText[MAX_STRING_CHARS] = "";
Expand All @@ -3669,18 +3686,27 @@ static void FS_CheckPak0( void )

Q_strcat(errorText, sizeof(errorText),
va(" from the \"%s\" directory in your Quake 3 install or CD-ROM to:\n\n"
"%s%c%s%c\n\n", BASEGAME, fs_basepath->string, PATH_SEP, BASEGAME, PATH_SEP));
"%s%c%s%c\n\n", BASEGAME, installPath, PATH_SEP, BASEGAME, PATH_SEP));

Q_strcat(errorText, sizeof(errorText),
"Quake 3 must be purchased to legitimately obtain pak0. "
"Quake 3 1.32 point release files (pak1 through pak8) "
"are freely available at:\n\n"
"https://ioquake3.org/extras/patch-data/\n\n");

Q_strcat(errorText, sizeof(errorText),
va("Also check that your ioq3 executable is in "
"the correct place and that every file "
"in the \"%s\" directory is present and readable", BASEGAME));
if(installHome)
{
Q_strcat(errorText, sizeof(errorText),
va("Also check that every file "
"in the \"%s\" directory is present and readable", BASEGAME));
}
else
{
Q_strcat(errorText, sizeof(errorText),
va("Also check that your ioq3 executable is in "
"the correct place and that every file "
"in the \"%s\" directory is present and readable", BASEGAME));
}

Com_Error(ERR_FATAL, "%s", errorText);
}
Expand All @@ -3697,18 +3723,27 @@ static void FS_CheckPak0( void )

Q_strcat(errorText, sizeof(errorText),
va(" from the \"%s\" directory in your Quake 3 Team Arena install or CD-ROM to:\n\n"
"%s%c%s%c\n\n", BASETA, fs_basepath->string, PATH_SEP, BASETA, PATH_SEP));
"%s%c%s%c\n\n", BASETA, installPath, PATH_SEP, BASETA, PATH_SEP));

Q_strcat(errorText, sizeof(errorText),
"Quake 3 Team Arena must be purchased to legitimately obtain pak0. "
"Quake 3 Team Arena point release files (pak1 through pak3) "
"are freely available at:\n\n"
"https://ioquake3.org/extras/patch-data/\n\n");

Q_strcat(errorText, sizeof(errorText),
va("Also check that your ioq3 executable is in "
"the correct place and that every file "
"in the \"%s\" directory is present and readable", BASETA));
if(installHome)
{
Q_strcat(errorText, sizeof(errorText),
va("Also check that every file "
"in the \"%s\" directory is present and readable", BASETA));
}
else
{
Q_strcat(errorText, sizeof(errorText),
va("Also check that your ioq3 executable is in "
"the correct place and that every file "
"in the \"%s\" directory is present and readable", BASETA));
}

Com_Error(ERR_FATAL, "%s", errorText);
}
Expand Down

0 comments on commit a1fe522

Please sign in to comment.