00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00028 #ifndef __FILE_H__
00029 #define __FILE_H__
00030
00031 #include <stdio.h>
00032 #include <time.h>
00033
00034 #include "../common/platform.h"
00035 #include "../common/num_type.h"
00036
00037
00038
00039
00040 extern W32 UnixTimeToDosTime( time_t *t );
00041
00042
00044
00045
00046
00048 SW32 FS_FileLength( FILE *filestream );
00049 SW32 FS_FileRead( void *ptr, size_t size, size_t nmemb, FILE *stream );
00050 SW32 FS_FileOpen( const char *filename, FILE **file );
00051 SW32 FS_FileLoad( const char *path, void **buffer );
00052 wtBoolean FS_DeleteFile( const char *filename );
00053
00054
00055
00057
00058
00059
00061 wtBoolean FS_CreateDirectory( const char *dirname );
00062 wtBoolean FS_RemoveDirectory( const char *pathname );
00063 wtBoolean FS_ChangeCurrentDirectory( const char *path );
00064 char *FS_GetCurrentDirectory( void );
00065
00066
00067
00068
00069
00070 #define FA_ARCH BIT( 0 )
00071 #define FA_HIDDEN BIT( 1 )
00072 #define FA_RDONLY BIT( 2 )
00073 #define FA_DIR BIT( 3 )
00074 #define FA_SYSTEM BIT( 4 )
00075
00076 extern wtBoolean FS_CompareFileAttributes( const char *path, W32 musthave, W32 canthave );
00077
00078 struct filestats
00079 {
00080 W32 attributes;
00081 W32 creationtime;
00082 W32 lastaccesstime;
00083 W32 lastwritetime;
00084 };
00085
00086 wtBoolean FS_GetFileAttributes( const char *filename, struct filestats *fs );
00087
00088 char *FS_FindFirst( const char *path );
00089 char *FS_FindNext( void );
00090 void FS_FindClose( void );
00091
00092
00093
00095
00096
00097
00099 char *FS_getFileName( char *path );
00100 void FS_RemoveExtension( const char *in, char *out );
00101 char *FS_getFileExtension( const char *in );
00102 wtBoolean FS_getFileBase( const char *in, char *out, W32 size_out );
00103 wtBoolean FS_getPath( const char *in, char *out, W32 size_out );
00104
00105
00106 #endif