================== idCommonLocal::WriteConfigToFile ================== */
| 1097 | ================== |
| 1098 | */ |
| 1099 | void 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 | =============== |
no test coverage detected