summaryrefslogtreecommitdiff
path: root/source/sys_unix.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2008-01-28 12:48:33 +0000
committerAndrey Nazarov <skuller@skuller.net>2008-01-28 12:48:33 +0000
commita7c27a5d6fb7c7136459d5da819f8a44ed56fa64 (patch)
treef46ab398dca5baaf93217052b20d9785e8ceaf6a /source/sys_unix.c
parentfd05aeccc1570278e6895a6dada20614f38987fd (diff)
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.
Diffstat (limited to 'source/sys_unix.c')
-rw-r--r--source/sys_unix.c39
1 files changed, 33 insertions, 6 deletions
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;