engine: common: check XASH3D_BASEDIR when opening log file, fixes engine.log creation on Android

This commit is contained in:
Alibek Omarov
2026-05-07 12:23:56 +05:00
parent 568b7abc5f
commit d6bf06e997

View File

@@ -106,7 +106,17 @@ void Sys_InitLog( void )
// create log if needed
if( s_ld.log_active )
{
s_ld.logfile = fopen( s_ld.log_path, mode );
const char *basedir = getenv( "XASH3D_BASEDIR" );
if( !COM_StringEmptyOrNULL( basedir ) && s_ld.log_path[0] != '/' )
{
char fullpath[MAX_SYSPATH];
Q_snprintf( fullpath, sizeof( fullpath ), "%s/%s", basedir, s_ld.log_path );
s_ld.logfile = fopen( fullpath, mode );
}
if( !s_ld.logfile )
s_ld.logfile = fopen( s_ld.log_path, mode );
if ( !s_ld.logfile )
{