summaryrefslogtreecommitdiffstats
path: root/src/misc/extra
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/extra')
-rw-r--r--src/misc/extra/extraUtilFile.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c
index 9d3a2ae4..54e6efc2 100644
--- a/src/misc/extra/extraUtilFile.c
+++ b/src/misc/extra/extraUtilFile.c
@@ -249,11 +249,14 @@ char * Extra_FilePathWithoutName( char * FileName )
}
char * Extra_FileInTheSameDir( char * pPathFile, char * pFileName )
{
- static char pBuffer[1000];
- char * pPath = Extra_FilePathWithoutName( pPathFile );
- assert( strlen(pPath) + strlen(pFileName) < 990 );
- sprintf( pBuffer, "%s%s", pPath, pFileName );
- ABC_FREE( pPath );
+ static char pBuffer[1000]; char * pThis;
+ assert( strlen(pPathFile) + strlen(pFileName) < 990 );
+ memmove( pBuffer, pPathFile, strlen(pPathFile) );
+ for ( pThis = pBuffer + strlen(pPathFile) - 1; pThis >= pBuffer; pThis-- )
+ if ( *pThis == '\\' || *pThis == '/' )
+ break;
+ memmove( ++pThis, pFileName, strlen(pFileName) );
+ pThis[strlen(pFileName)] = '\0';
return pBuffer;
}
char * Extra_FileDesignName( char * pFileName )