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

Function FS_InitFilesystem

code/qcommon/files.cpp:2956–2994  ·  view source on GitHub ↗

================ FS_InitFilesystem Called only at inital startup, not when the filesystem is resetting due to a game change ================ */

Source from the content-addressed store, hash-verified

2954================
2955*/
2956void FS_InitFilesystem( void ) {
2957 // allow command line parms to override our defaults
2958 // we have to specially handle this, because normal command
2959 // line variable sets don't happen until after the filesystem
2960 // has already been initialized
2961 Com_StartupVariable( "fs_cdpath" );
2962 Com_StartupVariable( "fs_basepath" );
2963 Com_StartupVariable( "fs_homepath" );
2964 Com_StartupVariable( "fs_game" );
2965 Com_StartupVariable( "fs_copyfiles" );
2966 Com_StartupVariable( "fs_dirbeforepak" );
2967#ifdef MACOS_X
2968 Com_StartupVariable( "fs_apppath" );
2969#endif
2970
2971 const char *gamedir = Cvar_VariableString("fs_game");
2972 bool requestbase = false;
2973 if ( !FS_FilenameCompare( gamedir, BASEGAME ) )
2974 requestbase = true;
2975
2976 if ( requestbase )
2977 Cvar_Set2( "fs_game", "", qtrue );
2978
2979 // try to start up normally
2980 FS_Startup( BASEGAME );
2981
2982 // if we can't find default.cfg, assume that the paths are
2983 // busted and error out now, rather than getting an unreadable
2984 // graphics screen when the font fails to load
2985 if ( FS_ReadFile( "default.cfg", NULL ) <= 0 ) {
2986 Com_Error( ERR_FATAL, "Couldn't load default.cfg" );
2987 // bk001208 - SafeMode see below, FIXME?
2988 }
2989
2990 Q_strncpyz(lastValidBase, fs_basepath->string, sizeof(lastValidBase));
2991 Q_strncpyz(lastValidGame, fs_gamedirvar->string, sizeof(lastValidGame));
2992
2993 // bk001208 - SafeMode see below, FIXME?
2994}
2995
2996/*
2997================

Callers 1

Com_InitFunction · 0.70

Calls 8

Q_strncpyzFunction · 0.85
Com_StartupVariableFunction · 0.70
Cvar_VariableStringFunction · 0.70
FS_FilenameCompareFunction · 0.70
Cvar_Set2Function · 0.70
FS_StartupFunction · 0.70
FS_ReadFileFunction · 0.70
Com_ErrorFunction · 0.70

Tested by

no test coverage detected