|
|
@ -18,22 +18,22 @@ GNU General Public License for more details. |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
#include <sys/stat.h> |
|
|
|
#include <sys/stat.h> |
|
|
|
#include "xash3d_types.h" |
|
|
|
#include "xash3d_types.h" |
|
|
|
|
|
|
|
#include "port.h" |
|
|
|
#include "crtlib.h" |
|
|
|
#include "crtlib.h" |
|
|
|
#include "utils.h" |
|
|
|
#include "utils.h" |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
============ |
|
|
|
============ |
|
|
|
IsFileExists |
|
|
|
MakeDirectory |
|
|
|
============ |
|
|
|
============ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
qboolean IsFileExists( const char *filename ) |
|
|
|
qboolean MakeDirectory( const char *path ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct stat st; |
|
|
|
struct stat st; |
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret = stat( filename, &st ); |
|
|
|
if( -1 == _mkdir( path ) |
|
|
|
|
|
|
|
&& ( -1 == stat( path, &st ) |
|
|
|
if( ret == -1 ) |
|
|
|
|| !S_ISDIR(st.st_mode ) ) ) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -44,7 +44,7 @@ qboolean IsFileExists( const char *filename ) |
|
|
|
GetFileSize |
|
|
|
GetFileSize |
|
|
|
============ |
|
|
|
============ |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
off_t GetFileSize( FILE *fp ) |
|
|
|
off_t GetSizeOfFile( FILE *fp ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
struct stat st; |
|
|
|
struct stat st; |
|
|
|
int fd; |
|
|
|
int fd; |
|
|
@ -71,7 +71,7 @@ byte *LoadFile( const char *filename ) |
|
|
|
if( !fp ) |
|
|
|
if( !fp ) |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
|
|
size = GetFileSize( fp ); |
|
|
|
size = GetSizeOfFile( fp ); |
|
|
|
|
|
|
|
|
|
|
|
buf = malloc( size ); |
|
|
|
buf = malloc( size ); |
|
|
|
|
|
|
|
|
|
|
|