From a7c27a5d6fb7c7136459d5da819f8a44ed56fa64 Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Mon, 28 Jan 2008 12:48:33 +0000 Subject: Added `sv_mvd_capture_flags' variable. Re-introduced FOV compensation for player gun model. Made `gl_fastsky' actually work. Added support for following powerup carriers in MVD_Follow_f. --- source/sys_unix.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'source/sys_unix.c') diff --git a/source/sys_unix.c b/source/sys_unix.c index a91cf8a..ad84705 100644 --- a/source/sys_unix.c +++ b/source/sys_unix.c @@ -586,19 +586,22 @@ uint32 Sys_Realtime( void ) { Sys_Mkdir ================ */ -void Sys_Mkdir( const char *path ) { - mkdir( path, 0777 ); +qboolean Sys_Mkdir( const char *path ) { + if( mkdir( path, 0777 ) == -1 ) { + return qfalse; + } + return qtrue; } qboolean Sys_RemoveFile( const char *path ) { - if( remove( path ) ) { + if( unlink( path ) == -1 ) { return qfalse; } return qtrue; } qboolean Sys_RenameFile( const char *from, const char *to ) { - if( rename( from, to ) ) { + if( rename( from, to ) == -1 ) { return qfalse; } return qtrue; @@ -606,16 +609,40 @@ qboolean Sys_RenameFile( const char *from, const char *to ) { /* ================ -Sys_GetFileInfo +Sys_GetPathInfo ================ */ -qboolean Sys_GetFileInfo( const char *path, fsFileInfo_t *info ) { +qboolean Sys_GetPathInfo( const char *path, fsFileInfo_t *info ) { struct stat st; if( stat( path, &st ) == -1 ) { return qfalse; } + if( !S_ISREG( st.st_mode ) ) { + return qfalse; + } + + if( info ) { + info->size = st.st_size; + info->ctime = st.st_ctime; + info->mtime = st.st_mtime; + } + + return qtrue; +} + +qboolean Sys_GetFileInfo( FILE *fp, fsFileInfo_t *info ) { + struct stat st; + + if( fstat( fileno( fp ), &st ) == -1 ) { + return qfalse; + } + + if( !S_ISREG( st.st_mode ) ) { + return qfalse; + } + if( info ) { info->size = st.st_size; info->ctime = st.st_ctime; -- cgit v1.2.3