From 8d7b9c2f01c2fe56b7363c5636136c26c169c4de Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Wed, 22 Nov 2023 04:05:43 +0500 Subject: [PATCH] utils: mdldec: always write trailing slash for non-empty destination path. --- utils/mdldec/mdldec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/utils/mdldec/mdldec.c b/utils/mdldec/mdldec.c index 9f8c08c4..810184be 100644 --- a/utils/mdldec/mdldec.c +++ b/utils/mdldec/mdldec.c @@ -43,7 +43,7 @@ static qboolean IsValidName( char *name ) if( !( isalpha( *name ) || isdigit( *name ))) return false; - while( *( ++name)) + while( *( ++name )) { if( isalpha( *name ) || isdigit( *name ) || *name == '.' || *name == '-' || *name == '_' @@ -305,7 +305,7 @@ static qboolean LoadMDL( const char *modelname ) return false; } - if( Q_strcmp( ext, "mdl" ) ) + if( Q_stricmp( ext, "mdl" ) ) { fprintf( stderr, "ERROR: Only .mdl-files is supported.\n" ); return false; @@ -349,17 +349,18 @@ static qboolean LoadMDL( const char *modelname ) if( destdir[0] != '\0' ) { - if( !MakeDirectory( destdir ) ) + if( !MakeDirectory( destdir )) { fprintf( stderr, "ERROR: Couldn't create directory %s\n", destdir ); return false; } - - COM_PathSlashFix( destdir ); } else COM_ExtractFilePath( modelname, destdir ); + if( destdir[0] != '\0' ) + COM_PathSlashFix( destdir ); + len -= ( sizeof( ".mdl" ) - 1 ); // path length without extension if( !model_hdr->numtextures )