MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / WriteConfigToFile

Method WriteConfigToFile

neo/framework/Common.cpp:1099–1130  ·  view source on GitHub ↗

================== idCommonLocal::WriteConfigToFile ================== */

Source from the content-addressed store, hash-verified

1097==================
1098*/
1099void idCommonLocal::WriteConfigToFile( const char *filename ) {
1100 idFile *f;
1101#ifdef ID_WRITE_VERSION
1102 ID_TIME_T t;
1103 char *curtime;
1104 idStr runtag;
1105 idFile_Memory compressed( "compressed" );
1106 idBase64 out;
1107#endif
1108
1109 f = fileSystem->OpenFileWrite( filename, "fs_configpath" );
1110 if ( !f ) {
1111 Printf ("Couldn't write %s.\n", filename );
1112 return;
1113 }
1114
1115#ifdef ID_WRITE_VERSION
1116 assert( config_compressor );
1117 t = time( NULL );
1118 curtime = ctime( &t );
1119 sprintf( runtag, "%s - %s", cvarSystem->GetCVarString( "si_version" ), curtime );
1120 config_compressor->Init( &compressed, true, 8 );
1121 config_compressor->Write( runtag.c_str(), runtag.Length() );
1122 config_compressor->FinishCompress( );
1123 out.Encode( (const byte *)compressed.GetDataPtr(), compressed.Length() );
1124 f->Printf( "// %s\n", out.c_str() );
1125#endif
1126
1127 idKeyInput::WriteBindings( f );
1128 cvarSystem->WriteFlaggedVariables( CVAR_ARCHIVE, "seta", f );
1129 fileSystem->CloseFile( f );
1130}
1131
1132/*
1133===============

Callers 1

Com_WriteConfig_fFunction · 0.45

Calls 14

PrintfFunction · 0.85
sprintfFunction · 0.85
OpenFileWriteMethod · 0.80
GetCVarStringMethod · 0.80
FinishCompressMethod · 0.80
EncodeMethod · 0.80
GetDataPtrMethod · 0.80
WriteFlaggedVariablesMethod · 0.80
CloseFileMethod · 0.80
InitMethod · 0.45
WriteMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected