#include "stdafx.h"
#include "openttd.h"
#include "fios.h"
#include "fileio_func.h"
#include "string_func.h"
#include <sys/stat.h>
#include <unistd.h>
#include "table/strings.h"
Go to the source code of this file.
Typedefs | |
typedef FiosType | fios_getlist_callback_proc (SaveLoadDialogMode mode, const char *filename, const char *ext, char *title, const char *last) |
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, uint64 *tot) |
void | GetOldSaveGameName (const char *path, const char *file, char *title, const char *last) |
int CDECL | compare_FiosItems (const void *a, const void *b) |
Compare two FiosItem's. | |
void | FiosFreeSavegameList () |
Clear the list. | |
StringID | FiosGetDescText (const char **path, uint64 *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 (SaveLoadDialogMode mode, fios_getlist_callback_proc *callback_proc) |
Create a list of the files in a directory, according to some arbitrary rule. | |
FiosType | FiosGetSavegameListCallback (SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last) |
Callback for FiosGetFileList. | |
void | FiosGetSavegameList (SaveLoadDialogMode mode) |
Get a list of savegames. | |
static FiosType | FiosGetScenarioListCallback (SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last) |
Callback for FiosGetFileList. | |
void | FiosGetScenarioList (SaveLoadDialogMode mode) |
Get a list of scenarios. | |
static FiosType | FiosGetHeightmapListCallback (SaveLoadDialogMode mode, const char *file, const char *ext, char *title, const char *last) |
void | FiosGetHeightmapList (SaveLoadDialogMode mode) |
Variables | |
SmallVector< FiosItem, 32 > | _fios_items |
defined in fios.cpp | |
static char * | _fios_path |
SmallFiosItem | _file_to_saveload |
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 48 of file fios.cpp.
Referenced by FiosGetFileList().
StringID FiosGetDescText | ( | const char ** | path, | |
uint64 * | total_free | |||
) |
static FiosItem* FiosGetFileList | ( | SaveLoadDialogMode | 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 199 of file fios.cpp.
References SmallVector< T, S >::Append(), SmallVector< T, S >::Begin(), SmallVector< T, S >::Clear(), SmallVector< T, S >::Compact(), compare_FiosItems(), FS2OTTD(), SmallVector< T, S >::Get(), lastof, SmallVector< T, S >::Length(), lengthof, str_validate(), strecpy(), and ttd_opendir().
Referenced by FiosGetSavegameList(), and FiosGetScenarioList().
void FiosGetSavegameList | ( | SaveLoadDialogMode | mode | ) |
Get a list of savegames.
mode | Save/load mode. |
Definition at line 328 of file fios.cpp.
References FiosGetFileList(), FiosGetSavegameListCallback(), and SAVE_DIR.
FiosType FiosGetSavegameListCallback | ( | SaveLoadDialogMode | mode, | |
const char * | file, | |||
const char * | ext, | |||
char * | title, | |||
const char * | last | |||
) |
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 | |
last | Last available byte in buffer (to prevent buffer overflows); not used when title == NULL |
Definition at line 302 of file fios.cpp.
Referenced by FiosGetSavegameList().
void FiosGetScenarioList | ( | SaveLoadDialogMode | mode | ) |
Get a list of scenarios.
mode | Save/load mode. |
Definition at line 377 of file fios.cpp.
References FiosGetFileList(), FiosGetScenarioListCallback(), and SCENARIO_DIR.
static FiosType FiosGetScenarioListCallback | ( | SaveLoadDialogMode | mode, | |
const char * | file, | |||
const char * | ext, | |||
char * | title, | |||
const char * | last | |||
) | [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 | |
last | Last available byte in buffer (to prevent buffer overflows) |
Definition at line 353 of file fios.cpp.
Referenced by FiosGetScenarioList().