XDG home directory support

This commit is contained in:
Tim Angus committed 2025-10-19 15:58:27 +01:00
1 parent da4f9bd13d
commit 0ebf1df742
18 files changed
+527 -143

No files matched your search

+9 -9
View File
@@ -742,7 +742,7 @@ void CL_Record_f( void ) {
#endif
Com_sprintf(name, sizeof(name), "demos/%s.%s%d", demoName, DEMOEXT, com_protocol->integer);
if (!FS_FileExists(name))
if (!FS_FileExists_HomeData(name))
break; // file doesn't exist
}
}
@@ -750,7 +750,7 @@ void CL_Record_f( void ) {
// open the demo file
Com_Printf ("recording to %s.\n", name);
clc.demofile = FS_FOpenFileWrite( name );
clc.demofile = FS_FOpenFileWrite_HomeData( name );
if ( !clc.demofile ) {
Com_Printf ("ERROR: couldn't open.\n");
return;
@@ -903,7 +903,7 @@ void CL_DemoCompleted( void )
else
numFrames = clc.timeDemoFrames - 1;
f = FS_FOpenFileWrite( cl_timedemoLog->string );
f = FS_FOpenFileWrite_HomeData( cl_timedemoLog->string );
if( f )
{
FS_Printf( f, "# %s", buffer );
@@ -2197,7 +2197,7 @@ static void CL_BeginHttpDownload( const char *remoteURL ) {
CL_HTTP_BeginDownload(remoteURL);
Q_strncpyz(clc.downloadURL, remoteURL, sizeof(clc.downloadURL));
clc.download = FS_BaseDir_FOpenFileWrite(clc.downloadTempName);
clc.download = FS_BaseDir_FOpenFileWrite_HomeData(clc.downloadTempName);
if(!clc.download) {
Com_Error(ERR_DROP, "CL_BeginHTTPDownload: failed to open "
"%s for writing", clc.downloadTempName);
@@ -2233,7 +2233,7 @@ void CL_NextDownload(void)
// A download has finished, check whether this matches a referenced checksum
if(*clc.downloadName)
{
char *zippath = FS_BaseDir_BuildOSPath(Cvar_VariableString("fs_homepath"), clc.downloadName);
char *zippath = FS_BaseDir_BuildOSPath(Cvar_VariableString("fs_homedatapath"), clc.downloadName);
if(!FS_CompareZipChecksum(zippath))
Com_Error(ERR_DROP, "Incorrect checksum for file: %s", clc.downloadName);
@@ -2977,7 +2977,7 @@ void CL_Frame ( int msec ) {
clc.download = 0;
}
FS_BaseDir_Rename(clc.downloadTempName, clc.downloadName, qfalse);
FS_BaseDir_Rename_HomeData(clc.downloadTempName, clc.downloadName, qfalse);
clc.downloadRestart = qtrue;
CL_NextDownload();
}
@@ -3307,7 +3307,7 @@ void CL_InitRef( void ) {
ri.FS_FreeFileList = FS_FreeFileList;
ri.FS_ListFiles = FS_ListFiles;
ri.FS_FileIsInPAK = FS_FileIsInPAK;
ri.FS_FileExists = FS_FileExists;
ri.FS_FileExists = FS_FileExists_HomeData;
ri.Cvar_Get = Cvar_Get;
ri.Cvar_Set = Cvar_Set;
ri.Cvar_SetValue = Cvar_SetValue;
@@ -3418,7 +3418,7 @@ void CL_Video_f( void )
Com_sprintf( filename, MAX_OSPATH, "videos/video%d%d%d%d.avi",
a, b, c, d );
if( !FS_FileExists( filename ) )
if( !FS_FileExists_HomeData( filename ) )
break; // file doesn't exist
}
@@ -3471,7 +3471,7 @@ static void CL_GenerateQKey(void)
Com_Printf( "QKEY building random string\n" );
Com_RandomBytes( buff, sizeof(buff) );
f = FS_BaseDir_FOpenFileWrite( QKEY_FILE );
f = FS_BaseDir_FOpenFileWrite_HomeState( QKEY_FILE );
if( !f ) {
Com_Printf( "QKEY could not open %s for write\n",
QKEY_FILE );