FileSystem

Typedefs

typedef struct binocle_fs binocle_fs
typedef struct binocle_fs_file binocle_fs_file
typedef enum binocle_fs_supported binocle_fs_supported

Enums

enum binocle_fs_supported

Values:

enumerator BINOCLE_FS_SDL
enumerator BINOCLE_FS_PHYSFS

Functions

binocle_fs binocle_fs_new()
bool binocle_fs_init(binocle_fs *fs)
void binocle_fs_destroy(binocle_fs *fs)
bool binocle_fs_mount(char *path, char *mount_point, bool prepend_to_search_path)
bool binocle_fs_get_last_modification_time(char *filename, uint64_t *modtime)
void binocle_fs_enumerate(char *path, PHYSFS_EnumerateCallback callback, void *user_data)
bool binocle_fs_is_directory(const char *filename)
binocle_fs_file binocle_fs_open_read(const char *filename)
void binocle_fs_close(binocle_fs_file file)
bool binocle_fs_read(binocle_fs_file file, void **buffer, size_t *size)
bool binocle_fs_load_binary_file(const char *filename, void **buffer, size_t *size)
bool binocle_fs_load_text_file(const char *filename, char **buffer, size_t *size)
void binocle_fs_get_directory(const char *filename, char *path, int *length)

Gets the directory part of the filename+path given as input.

Parameters:
  • filename – the full path including the filename

  • path – the path without the filename and with no trailing slash

  • length – the length of the returned path

void binocle_fs_get_filename(const char *full_path, char *filename, int *length)

Return the file name given a full path.

Parameters:
  • full_path – the full path

  • filename – the filename extracted from the path

  • length – the length of the filename;

void binocle_fs_path_without_extension(char *myStr, char extSep, char pathSep, char *retStr)

Returns the filename without the extension.

Parameters:
  • myStr – the full filename (it can include the path)

  • extSep – the separator character, e.g. “.”

  • pathSep – the path separator, e.g. “/”

  • retStr – the filename without extension (including path if provided)

struct binocle_fs

Public Members

uint64_t dummy
struct binocle_fs_file

Public Members

PHYSFS_File *file
char *filename