Skip to content

Commit

Permalink
engine: change current working directory before initializing filesyst…
Browse files Browse the repository at this point in the history
…em_stdio
  • Loading branch information
a1batross committed Jul 9, 2024
1 parent 64716e6 commit 6ff3231
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions engine/common/filesystem_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,20 @@ void FS_Init( const char *basedir )
Q_strncpy( gamedir, basedir, sizeof( gamedir )); // gamedir == basedir

FS_LoadProgs();

// TODO: this function will cause engine to stop in case of fail
// when it will have an option to return string error, restore Sys_Error
// FIXME: why do we call this function before InitStdio?
// because InitStdio immediately scans all available game directories
// and this better be reworked at some point
g_fsapi.SetCurrentDirectory( rootdir );

if( !g_fsapi.InitStdio( true, rootdir, basedir, gamedir, rodir ))
{
Sys_Error( "Can't init filesystem_stdio!\n" );
return;
}

// TODO: this function will cause engine to stop in case of fail
// when it will have an option to return string error, restore Sys_Error
g_fsapi.SetCurrentDirectory( rootdir );

Cmd_AddRestrictedCommand( "fs_rescan", FS_Rescan_f, "rescan filesystem search pathes" );
Cmd_AddRestrictedCommand( "fs_path", FS_Path_f_, "show filesystem search pathes" );
Cmd_AddRestrictedCommand( "fs_clearpaths", FS_ClearPaths_f, "clear filesystem search pathes" );
Expand Down

0 comments on commit 6ff3231

Please sign in to comment.