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

Function Com_WriteConfig_f

code/qcommon/common.cpp:1233–1258  ·  view source on GitHub ↗

=============== Com_WriteConfig_f Write the config file to a specific name =============== */

Source from the content-addressed store, hash-verified

1231===============
1232*/
1233void Com_WriteConfig_f( void ) {
1234 char filename[MAX_QPATH];
1235
1236 if ( Cmd_Argc() != 2 ) {
1237 Com_Printf( "Usage: writeconfig <filename>\n" );
1238 return;
1239 }
1240
1241 Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
1242 COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
1243
1244 if(!COM_CompareExtension(filename, ".cfg"))
1245 {
1246 Com_Printf( "Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n" );
1247 return;
1248 }
1249
1250 if(!FS_FilenameCompare(filename, "mpdefault.cfg") || !FS_FilenameCompare(filename, "default.cfg"))
1251 {
1252 Com_Printf( S_COLOR_YELLOW "Com_WriteConfig_f: The filename \"%s\" is reserved! Please choose another name.\n", filename );
1253 return;
1254 }
1255
1256 Com_Printf( "Writing %s.\n", filename );
1257 Com_WriteConfigToFile( filename );
1258}
1259
1260/*
1261================

Callers

nothing calls this directly

Calls 8

Q_strncpyzFunction · 0.85
Cmd_ArgcFunction · 0.70
Com_PrintfFunction · 0.70
Cmd_ArgvFunction · 0.70
COM_DefaultExtensionFunction · 0.70
COM_CompareExtensionFunction · 0.70
FS_FilenameCompareFunction · 0.70
Com_WriteConfigToFileFunction · 0.70

Tested by

no test coverage detected