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

Function FS_SV_FOpenFileWrite

code/qcommon/files.cpp:777–809  ·  view source on GitHub ↗

=========== FS_SV_FOpenFileWrite =========== */

Source from the content-addressed store, hash-verified

775===========
776*/
777fileHandle_t FS_SV_FOpenFileWrite( const char *filename ) {
778 char *ospath;
779 fileHandle_t f;
780
781 FS_AssertInitialised();
782
783 ospath = FS_BuildOSPath( fs_homepath->string, filename, "" );
784 ospath[strlen(ospath)-1] = '\0';
785
786 f = FS_HandleForFile();
787 fsh[f].zipFile = qfalse;
788
789 if ( fs_debug->integer ) {
790 Com_Printf( "FS_SV_FOpenFileWrite: %s\n", ospath );
791 }
792
793 FS_CheckFilenameIsMutable( ospath, __func__ );
794
795 if( FS_CreatePath( ospath ) ) {
796 return 0;
797 }
798
799 Com_DPrintf( "writing to: %s\n", ospath );
800 fsh[f].handleFiles.file.o = fopen( ospath, "wb" );
801
802 Q_strncpyz( fsh[f].name, filename, sizeof( fsh[f].name ) );
803
804 fsh[f].handleSync = qfalse;
805 if (!fsh[f].handleFiles.file.o) {
806 f = 0;
807 }
808 return f;
809}
810
811/*
812===========

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected