#include <stdio.h>
#include <time.h>
#include "../common/platform.h"
#include "../common/num_type.h"
Go to the source code of this file.
Data Structures | |
struct | filestats |
Defines | |
#define | FA_ARCH BIT( 0 ) |
#define | FA_HIDDEN BIT( 1 ) |
#define | FA_RDONLY BIT( 2 ) |
#define | FA_DIR BIT( 3 ) |
#define | FA_SYSTEM BIT( 4 ) |
Functions | |
W32 | UnixTimeToDosTime (time_t *t) |
Converts Unix time_t into DOS format. | |
SW32 | FS_FileLength (FILE *filestream) |
Calculate file length. | |
SW32 | FS_FileRead (void *ptr, size_t size, size_t nmemb, FILE *stream) |
Reads data from binary file stream. | |
SW32 | FS_FileOpen (const char *filename, FILE **file) |
Open a file stream. | |
SW32 | FS_FileLoad (const char *path, void **buffer) |
Load a file into memory. | |
wtBoolean | FS_DeleteFile (const char *filename) |
Deletes an existing file. | |
wtBoolean | FS_CreateDirectory (const char *dirname) |
Creates a new directory. | |
wtBoolean | FS_RemoveDirectory (const char *pathname) |
Deletes an existing empty directory. | |
wtBoolean | FS_ChangeCurrentDirectory (const char *path) |
Changes the current directory. | |
char * | FS_GetCurrentDirectory (void) |
Gets the current working directory. | |
wtBoolean | FS_CompareFileAttributes (const char *path, W32 musthave, W32 canthave) |
Compare directory and file attributes. | |
wtBoolean | FS_GetFileAttributes (const char *filename, struct filestats *fs) |
Retrieves attributes for a specified file or directory. | |
char * | FS_FindFirst (const char *path) |
Searches a directory for a file or subdirectory with a name that matches a specific name. | |
char * | FS_FindNext (void) |
Continues a file search from a previous call to the FS_FindFirst function. | |
void | FS_FindClose (void) |
Closes the search handle. | |
char * | FS_getFileName (char *path) |
Returns file name from path string. | |
void | FS_RemoveExtension (const char *in, char *out) |
Removes file extension from path string. | |
char * | FS_getFileExtension (const char *in) |
Returns file extension from path string. | |
wtBoolean | FS_getFileBase (const char *in, char *out, W32 size_out) |
Returns base file name from path string. | |
wtBoolean | FS_getPath (const char *in, char *out, W32 size_out) |
Returns path from full path. |
wtBoolean FS_ChangeCurrentDirectory | ( | const char * | path | ) |
Changes the current directory.
[in] | path | Pointer to a NUL-terminated string that specifies the path to the new directory. |
wtBoolean FS_CompareFileAttributes | ( | const char * | path, | |
W32 | musthave, | |||
W32 | canthave | |||
) |
Compare directory and file attributes.
[in] | path | Specifies the path to compare file attributes. |
[in] | musthave | File or directory must have these attributes. |
[in] | canthave | File or directory can not have these attributes. |
wtBoolean FS_CreateDirectory | ( | const char * | dirname | ) |
Creates a new directory.
[in] | dirname | Pointer to a NUL-terminated string that specifies the path of the directory to be created. |
wtBoolean FS_DeleteFile | ( | const char * | filename | ) |
Deletes an existing file.
[in] | filename | Pointer to a NUL-terminated string that specifies the file to be deleted. |
SW32 FS_FileLength | ( | FILE * | stream | ) |
Calculate file length.
[in] | filestream | Pointer to valid FILE structure. |
SW32 FS_FileLoad | ( | const char * | path, | |
void ** | buffer | |||
) |
Load a file into memory.
[in] | path | File name to load. |
[in,out] | buffer | Buffer to hold data |
SW32 FS_FileOpen | ( | const char * | filename, | |
FILE ** | file | |||
) |
Open a file stream.
[in] | filename | Name of file to open. |
[out] | file | FILE pointer. |
SW32 FS_FileRead | ( | void * | ptr, | |
size_t | size, | |||
size_t | nmemb, | |||
FILE * | stream | |||
) |
Reads data from binary file stream.
[in,out] | ptr | Storage location. |
[in] | size | Size of object in bytes. |
[in] | nmemb | Number of objects to read. |
[in] | stream | Stream to read from. |
char* FS_FindFirst | ( | const char * | path | ) |
Searches a directory for a file or subdirectory with a name that matches a specific name.
[in] | path | Pointer to a NUL-terminated string that specifies a valid directory or path and file name that can contain wildcard characters. |
[in] | path | Pointer to a NUL-terminated string that specifies a valid directory or path and file name that can contain wildcard characters. |
char* FS_FindNext | ( | void | ) |
Continues a file search from a previous call to the FS_FindFirst function.
char* FS_GetCurrentDirectory | ( | void | ) |
Gets the current working directory.
wtBoolean FS_GetFileAttributes | ( | const char * | filename, | |
struct filestats * | fs | |||
) |
Retrieves attributes for a specified file or directory.
[in] | filename | Pointer to a NUL-terminated string that specifies a file or directory. |
[in] | fs | Pointer to a filestats structure that receives the attribute information. |
wtBoolean FS_getFileBase | ( | const char * | in, | |
char * | out, | |||
W32 | size_out | |||
) |
Returns base file name from path string.
[in] | in | Path to get file extension from. |
[in,out] | out | File name. |
[in] | size_out | Size of out buffer in bytes. |
char* FS_getFileExtension | ( | const char * | in | ) |
Returns file extension from path string.
[in] | in | Path to get file extension from. |
char* FS_getFileName | ( | char * | path | ) |
Returns file name from path string.
[in] | path | Path to get file name from. |
wtBoolean FS_getPath | ( | const char * | in, | |
char * | out, | |||
W32 | size_out | |||
) |
Returns path from full path.
[in] | in | Path with file name. |
[in,out] | out | path. |
[in] | size_out | Size of out buffer in bytes. |
wtBoolean FS_RemoveDirectory | ( | const char * | pathname | ) |
Deletes an existing empty directory.
[in] | dirname | Pointer to a NUL-terminated string that specifies the directory to be deleted. |
void FS_RemoveExtension | ( | const char * | in, | |
char * | out | |||
) |
Removes file extension from path string.
[in] | in | Path to remove file extension. |
[in] | out | Pointer to hold path string. |
W32 UnixTimeToDosTime | ( | time_t * | t | ) |
Converts Unix time_t into DOS format.
[in] | t | unix time to convert. |