From d6bf06e9976567c204235e76b09a93cc727df91b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 7 May 2026 12:23:56 +0500 Subject: [PATCH] engine: common: check XASH3D_BASEDIR when opening log file, fixes engine.log creation on Android --- engine/common/sys_con.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/engine/common/sys_con.c b/engine/common/sys_con.c index abd42279..1688f982 100644 --- a/engine/common/sys_con.c +++ b/engine/common/sys_con.c @@ -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 ) {