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

Method OpenFileWrite

neo/framework/FileSystem.cpp:3205–3245  ·  view source on GitHub ↗

=========== idFileSystemLocal::OpenFileWrite =========== */

Source from the content-addressed store, hash-verified

3203===========
3204*/
3205idFile *idFileSystemLocal::OpenFileWrite( const char *relativePath, const char *basePath ) {
3206 const char *path;
3207 idStr OSpath;
3208 idFile_Permanent *f;
3209
3210 if ( !searchPaths ) {
3211 common->FatalError( "Filesystem call made without initialization\n" );
3212 }
3213
3214 path = cvarSystem->GetCVarString( basePath );
3215 if ( !path[0] ) {
3216 path = fs_savepath.GetString();
3217 }
3218
3219 OSpath = BuildOSPath( path, gameFolder, relativePath );
3220
3221 if ( fs_debug.GetInteger() ) {
3222 common->Printf( "idFileSystem::OpenFileWrite: %s\n", OSpath.c_str() );
3223 }
3224
3225 // if the dir we are writing to is in our current list, it will be outdated
3226 // so just flush everything
3227 ClearDirCache();
3228
3229 common->DPrintf( "writing to: %s\n", OSpath.c_str() );
3230 CreateOSPath( OSpath );
3231
3232 f = new idFile_Permanent();
3233 f->o = OpenOSFile( OSpath, "wb" );
3234 if ( !f->o ) {
3235 delete f;
3236 return NULL;
3237 }
3238 f->name = relativePath;
3239 f->fullPath = OSpath;
3240 f->mode = ( 1 << FS_WRITE );
3241 f->handleSync = false;
3242 f->fileSize = 0;
3243
3244 return f;
3245}
3246
3247/*
3248===========

Callers 15

DumpOggSoundsMethod · 0.80
WriteGameStateMethod · 0.80
Cmd_TestSave_fFunction · 0.80
QE_SaveProjectFunction · 0.80
saveMethod · 0.80
WriteOutputFileFunction · 0.80
WriteBspBrushMapFunction · 0.80
idBrushMapMethod · 0.80
LeakFileMethod · 0.80
WriteMethod · 0.80
InitRoQFileMethod · 0.80

Calls 7

GetCVarStringMethod · 0.80
GetIntegerMethod · 0.80
FatalErrorMethod · 0.45
GetStringMethod · 0.45
PrintfMethod · 0.45
c_strMethod · 0.45
DPrintfMethod · 0.45

Tested by

no test coverage detected