================ idSessionLocal::WriteCDKey ================ */
| 3150 | ================ |
| 3151 | */ |
| 3152 | void 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 | =============== |
no test coverage detected