MCPcopy Create free account
hub / github.com/JACoders/OpenJK / FS_FOpenFileWrite

Function FS_FOpenFileWrite

code/qcommon/files.cpp:1002–1037  ·  view source on GitHub ↗

=========== FS_FOpenFileWrite =========== */

Source from the content-addressed store, hash-verified

1000===========
1001*/
1002fileHandle_t FS_FOpenFileWrite( const char *filename, qboolean safe ) {
1003 char *ospath;
1004 fileHandle_t f;
1005
1006 FS_AssertInitialised();
1007
1008 f = FS_HandleForFile();
1009 fsh[f].zipFile = qfalse;
1010
1011 ospath = FS_BuildOSPath( fs_homepath->string, fs_gamedir, filename );
1012
1013 if ( fs_debug->integer ) {
1014 Com_Printf( "FS_FOpenFileWrite: %s\n", ospath );
1015 }
1016
1017 if ( safe ) {
1018 FS_CheckFilenameIsMutable( ospath, __func__ );
1019 }
1020
1021 if( FS_CreatePath( ospath ) ) {
1022 return 0;
1023 }
1024
1025 // enabling the following line causes a recursive function call loop
1026 // when running with +set logfile 1 +set developer 1
1027 //Com_DPrintf( "writing to: %s\n", ospath );
1028 fsh[f].handleFiles.file.o = fopen( ospath, "wb" );
1029
1030 Q_strncpyz( fsh[f].name, filename, sizeof( fsh[f].name ) );
1031
1032 fsh[f].handleSync = qfalse;
1033 if (!fsh[f].handleFiles.file.o) {
1034 f = 0;
1035 }
1036 return f;
1037}
1038
1039/*
1040===========

Callers 9

createMethod · 0.70
Com_PrintfFunction · 0.70
Com_WriteCamFunction · 0.70
Com_WriteConfigToFileFunction · 0.70
Com_FrameFunction · 0.70
FS_WriteFileFunction · 0.70
FS_FOpenFileByModeFunction · 0.70
Con_Dump_fFunction · 0.50
R_CheckMP3sFunction · 0.50

Calls 7

Q_strncpyzFunction · 0.85
FS_AssertInitialisedFunction · 0.70
FS_HandleForFileFunction · 0.70
FS_BuildOSPathFunction · 0.70
Com_PrintfFunction · 0.70
FS_CreatePathFunction · 0.70

Tested by

no test coverage detected