#include "stdafx.h"
#include "openttd.h"
#include "variables.h"
#include "heightmap.h"
#include "fios.h"
#include "fileio.h"
#include "core/alloc_func.hpp"
#include "functions.h"
#include "string_func.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "table/strings.h"
Go to the source code of this file.
Typedefs | |
typedef byte | fios_getlist_callback_proc (int mode, const char *filename, const char *ext, char *title) |
Functions | |
bool | FiosIsRoot (const char *path) |
bool | FiosIsValidFile (const char *path, const struct dirent *ent, struct stat *sb) |
bool | FiosIsHiddenFile (const struct dirent *ent) |
void | FiosGetDrives () |
bool | FiosGetDiskFreeSpace (const char *path, uint32 *tot) |
void | GetOldSaveGameName (char *title, const char *path, const char *file) |
FiosItem * | FiosAlloc () |
Allocate a new FiosItem. | |
int CDECL | compare_FiosItems (const void *a, const void *b) |
Compare two FiosItem's. | |
void | FiosFreeSavegameList () |
Free the list of savegames. | |
StringID | FiosGetDescText (const char **path, uint32 *total_free) |
Get descriptive texts. | |
char * | FiosBrowseTo (const FiosItem *item) |
void | FiosMakeSavegameName (char *buf, const char *name, size_t size) |
bool | FiosDelete (const char *name) |
bool | FileExists (const char *filename) |
static FiosItem * | FiosGetFileList (int mode, fios_getlist_callback_proc *callback_proc) |
Create a list of the files in a directory, according to some arbitrary rule. | |
byte | FiosGetSavegameListCallback (int mode, const char *file, const char *ext, char *title) |
Callback for FiosGetFileList. | |
FiosItem * | FiosGetSavegameList (int mode) |
Get a list of savegames. | |
static byte | FiosGetScenarioListCallback (int mode, const char *file, const char *ext, char *title) |
Callback for FiosGetFileList. | |
FiosItem * | FiosGetScenarioList (int mode) |
Get a list of scenarios. | |
static byte | FiosGetHeightmapListCallback (int mode, const char *file, const char *ext, char *title) |
FiosItem * | FiosGetHeightmapList (int mode) |
Variables | |
int | _fios_num |
defined in fios.cpp, read_only version of _fios_count | |
static char * | _fios_path |
static FiosItem * | _fios_items |
SmallFiosItem | _file_to_saveload |
static int | _fios_count |
static int | _fios_alloc |
Definition in file fios.cpp.
int CDECL compare_FiosItems | ( | const void * | a, | |
const void * | b | |||
) |
Compare two FiosItem's.
Used with qsort when sorting the file list.
a | A pointer to the first FiosItem to compare. | |
b | A pointer to the second FiosItem to compare. |
Definition at line 67 of file fios.cpp.
Referenced by FiosGetFileList().
FiosItem* FiosAlloc | ( | ) |
Allocate a new FiosItem.
Definition at line 52 of file fios.cpp.
References ReallocT().
Referenced by FiosGetFileList().
StringID FiosGetDescText | ( | const char ** | path, | |
uint32 * | total_free | |||
) |
static FiosItem* FiosGetFileList | ( | int | mode, | |
fios_getlist_callback_proc * | callback_proc | |||
) | [static] |
Create a list of the files in a directory, according to some arbitrary rule.
mode | The mode we are in. Some modes don't allow 'parent'. | |
callback_proc | The function that is called where you need to do the filtering. |
Definition at line 217 of file fios.cpp.
References _fios_num, compare_FiosItems(), FiosAlloc(), FS2OTTD(), str_validate(), and ttd_opendir().
Referenced by FiosGetSavegameList(), and FiosGetScenarioList().
FiosItem* FiosGetSavegameList | ( | int | mode | ) |
Get a list of savegames.
mode | Save/load mode. |
Definition at line 342 of file fios.cpp.
References FiosGetFileList(), FiosGetSavegameListCallback(), and SAVE_DIR.
byte FiosGetSavegameListCallback | ( | int | mode, | |
const char * | file, | |||
const char * | ext, | |||
char * | title | |||
) |
Callback for FiosGetFileList.
It tells if a file is a savegame or not.
mode | Save/load mode. | |
file | Name of the file to check. | |
ext | A pointer to the extension identifier inside file | |
title | Buffer if a callback wants to lookup the title of the file; NULL to skip the lookup |
Definition at line 316 of file fios.cpp.
Referenced by FiosGetSavegameList().
FiosItem* FiosGetScenarioList | ( | int | mode | ) |
Get a list of scenarios.
mode | Save/load mode. |
Definition at line 390 of file fios.cpp.
References FiosGetFileList(), FiosGetScenarioListCallback(), and SCENARIO_DIR.
static byte FiosGetScenarioListCallback | ( | int | mode, | |
const char * | file, | |||
const char * | ext, | |||
char * | title | |||
) | [static] |
Callback for FiosGetFileList.
It tells if a file is a scenario or not.
mode | Save/load mode. | |
file | Name of the file to check. | |
ext | A pointer to the extension identifier inside file | |
title | Buffer if a callback wants to lookup the title of the file |
Definition at line 366 of file fios.cpp.
Referenced by FiosGetScenarioList().