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

Method WriteCDKey

neo/framework/Session.cpp:3152–3178  ·  view source on GitHub ↗

================ idSessionLocal::WriteCDKey ================ */

Source from the content-addressed store, hash-verified

3150================
3151*/
3152void idSessionLocal::WriteCDKey( void ) {
3153 idStr filename;
3154 idFile *f;
3155 const char *OSPath;
3156
3157 filename = CDKEY_FILEPATH;
3158 // OpenFileWrite advertises creating directories to the path if needed, but that won't work with a '..' in the path
3159 // occasionally on windows, but mostly on Linux and OSX, the fs_configpath/base may not exist in full
3160 OSPath = fileSystem->BuildOSPath( cvarSystem->GetCVarString( "fs_configpath" ), BASE_GAMEDIR, CDKEY_FILE );
3161 fileSystem->CreateOSPath( OSPath );
3162 f = fileSystem->OpenFileWrite( filename, "fs_configpath" );
3163 if ( !f ) {
3164 common->Printf( "Couldn't write %s.\n", filename.c_str() );
3165 return;
3166 }
3167 f->Printf( "%s%s", cdkey, CDKEY_TEXT );
3168 fileSystem->CloseFile( f );
3169
3170 filename = XPKEY_FILEPATH;
3171 f = fileSystem->OpenFileWrite( filename, "fs_configpath" );
3172 if ( !f ) {
3173 common->Printf( "Couldn't write %s.\n", filename.c_str() );
3174 return;
3175 }
3176 f->Printf( "%s%s", xpkey, CDKEY_TEXT );
3177 fileSystem->CloseFile( f );
3178}
3179
3180/*
3181===============

Callers 2

Session_PromptKey_fFunction · 0.80
WriteConfigurationMethod · 0.80

Calls 7

BuildOSPathMethod · 0.80
GetCVarStringMethod · 0.80
CreateOSPathMethod · 0.80
OpenFileWriteMethod · 0.80
CloseFileMethod · 0.80
PrintfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected