mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-12-27 11:16:43 +01:00
utils: mdldec: create full destination path into "Kratisto's mdldec" maner.
This commit is contained in:
parent
9ec1e259b4
commit
f9b6389248
@ -351,11 +351,8 @@ static qboolean LoadMDL( const char *modelname )
|
||||
|
||||
if( destdir[0] != '\0' )
|
||||
{
|
||||
if( !MakeDirectory( destdir ))
|
||||
{
|
||||
fprintf( stderr, "ERROR: Couldn't create directory %s\n", destdir );
|
||||
if( !MakeFullPath( destdir ))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
COM_ExtractFilePath( modelname, destdir );
|
||||
|
@ -54,6 +54,40 @@ qboolean MakeDirectory( const char *path )
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
MakeFullPath
|
||||
============
|
||||
*/
|
||||
qboolean MakeFullPath( const char *path )
|
||||
{
|
||||
char *p = (char *)path, tmp;
|
||||
|
||||
for( ; *p; )
|
||||
{
|
||||
p = Q_strpbrk( p, "/\\" );
|
||||
|
||||
if( p )
|
||||
{
|
||||
tmp = *p;
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
if( !MakeDirectory( path ))
|
||||
{
|
||||
fprintf( stderr, "ERROR: Couldn't create directory %s\n", path );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !p )
|
||||
break;
|
||||
|
||||
*p++ = tmp;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
ExtractFileName
|
||||
|
@ -17,6 +17,7 @@ GNU General Public License for more details.
|
||||
#define UTILS_H
|
||||
|
||||
qboolean MakeDirectory( const char *path );
|
||||
qboolean MakeFullPath( const char *path );
|
||||
void ExtractFileName( char *name, size_t size );
|
||||
off_t GetSizeOfFile( FILE *fp );
|
||||
byte *LoadFile( const char *filename, off_t *size );
|
||||
|
Loading…
Reference in New Issue
Block a user