Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Classes

NameDescription
Geo::GeoFileManager

The file manager deals with locating resources given a path and a filename.

Enums

NameDescription
GeoFSeekOrigin

To avoid pulling in the entire stdio header, use our own values for GeoFSeek.

Typedefs

NameDescription
void(* FileOpenCallback)(const char *path, const char *mode)

path: path to the file being opened.

__int64 offset_t

A offset type, similar to size_t (off_t is not supported on all used platforms)

Functions

NameDescription
FileExists(const char *)

Checks that testFile exists.

FileExistsAndIsNewer(const char *, const char *)

Checks that testFile exists and is newer than exemplarFile.

FileIsWritable(const char *)

Checks that the file named filename can be written to.

FreeLoadedFile(void *)

Free a previously loaded file.

GeoConstructAPIFilename(const char *, char *)

Construct a filename for use in the underlying platform filesystem API.

GeoDeleteFile(const char *)

Delete a file.

GeoDirectoryCreate(const char *)

Creates a directory and all the directories leading up to it.

GeoFClose(FILE *)

A safe alternative to fclose.

GeoFEof(FILE *)

A safe alternative to feof.

GeoFError(FILE *)

A safe alternative to ferror. Returns a non-zero value to indicate an error.

GeoFOpen(const char *, const char *)

GeoFOpen.

GeoFRead(void *, size_t, size_t, FILE *)

A safe alternative to fread.

GeoFSeek(offset_t, GeoFSeekOrigin, FILE *)

A safe alternative to fseek.

GeoFTell(FILE *)

A safe alternative to ftell.

GeoFWrite(const void *, size_t, size_t, FILE *)

A safe alternative to fwrite.

GeoRenameFile(const char *, const char *)

Rename a file.

GetFileSystemPrefix()

Get the previously set file system prefix for the current platform.

InvokeFileOpenCallback(const char *, const char *)

Invoke the file open callback, if set.

LoadFile(const char *, u32 &, u32, u32)

A safe alternative to ferror.

LoadFileStr(const char *, u32 &, u32)

Load a file and append a null terminator.

SaveFile(const char *, const void *, u32)

Save a file.

SetFileOpenCallback(FileOpenCallback)

Set the function to be called when a file is opened, or a null pointer to disable the callback.

SetFileSystemPrefix(const char *)

Set a file system prefix for the current platform.


Anchor
a7d256a503bd1caf5bb23ec5f016a0220
a7d256a503bd1caf5bb23ec5f016a0220

GeoFSeekOrigin

...

public: enum GeoFSeekOrigin
{
    GEO_SEEK_SET = 0,
    GEO_SEEK_CUR = 1,
    GEO_SEEK_END = 2
}

...

To avoid pulling in the entire stdio header, use our own values for GeoFSeek.

enumerators
GEO_SEEK_SET

Seek from beginning of file (SEEK_SET)

GEO_SEEK_CUR

Seek from current position (SEEK_CUR)

GEO_SEEK_END

Seek from end of file (SEEK_END)


Anchor
aee946e3059cbadc7f626771d2e8f06e3
aee946e3059cbadc7f626771d2e8f06e3

bool GEO_CALL Geo::FileExists

...

public: bool GEO_CALL FileExists
(
    const char * testFile
)

...

Checks that testFile exists.


Anchor
a77b51a3ef18ccb962645131e0eadafb9
a77b51a3ef18ccb962645131e0eadafb9

bool GEO_CALL Geo::FileExistsAndIsNewer

...

public: bool GEO_CALL FileExistsAndIsNewer
(
    const char * testFile,
    const char * exemplarFile
)

...

Checks that testFile exists and is newer than exemplarFile.

Returns true iff both files exist and the testFile has been modified more recently than exemplarFile.


Anchor
a3c00fd19b3c170f2a810300389f2c3f4
a3c00fd19b3c170f2a810300389f2c3f4

bool GEO_CALL Geo::FileIsWritable

...

public: bool GEO_CALL FileIsWritable
(
    const char * filename
)

...

Checks that the file named filename can be written to.

Returns true for a writable existing file, or if a file with that name could be created.


Anchor
a3fcf58f8cf69efc679742e6f8c018ee6
a3fcf58f8cf69efc679742e6f8c018ee6

void GEO_CALL Geo::FreeLoadedFile

...

public: void GEO_CALL FreeLoadedFile
(
    void * file
)

...

Free a previously loaded file.


Anchor
a9f432430136e89e779c8609faa3de5eb
a9f432430136e89e779c8609faa3de5eb

bool Geo::GeoConstructAPIFilename

...

public: bool GeoConstructAPIFilename
(
    const char * inFilename,
    char * outFilename
)

...

Construct a filename for use in the underlying platform filesystem API.


Anchor
ad25a06953cf50ab439a93c438c8035b2
ad25a06953cf50ab439a93c438c8035b2

bool Geo::GeoDeleteFile

...

public: bool GeoDeleteFile
(
    const char * filename
)

...

Delete a file.


Anchor
a950587336c5032628c6d17549587f653
a950587336c5032628c6d17549587f653

bool GEO_CALL Geo::GeoDirectoryCreate

...

public: bool GEO_CALL GeoDirectoryCreate
(
    const char * directory
)

...

Creates a directory and all the directories leading up to it.

Used often in the pipeline tools

Note
titleNote

Does nothing (and returns false) on a console


Anchor
ab37f2d55964a135a5ecf0cbe040e11e8
ab37f2d55964a135a5ecf0cbe040e11e8

int GEO_CALL Geo::GeoFClose

...

public: int GEO_CALL GeoFClose
(
    FILE * stream
)

...

A safe alternative to fclose.


Anchor
ae9f9140c39ccfd9e05bf207128440349
ae9f9140c39ccfd9e05bf207128440349

int GEO_CALL Geo::GeoFEof

...

public: int GEO_CALL GeoFEof
(
    FILE * stream
)

...

A safe alternative to feof.


Anchor
acc4751f2f939c6264a6da31bdb4240ab
acc4751f2f939c6264a6da31bdb4240ab

Geo::s32 GEO_CALL Geo::GeoFError

...

public: Geo::s32GEO_CALL GeoFError
(
    FILE * file
)

...

A safe alternative to ferror. Returns a non-zero value to indicate an error.


Anchor
a2fa361249e782e02c17e1367a1b3a996
a2fa361249e782e02c17e1367a1b3a996

FILE* GEO_CALL Geo::GeoFOpen

...

public: FILE *GEO_CALL GeoFOpen
(
    const char * filename,
    const char * mode
)

...

GeoFOpen.

Calls the operating system's fopen() method, and returns a FILE* in the usual fashion, however it takes account of any local system convension for file paths, and transparently manages these behind the scenes.


Anchor
aae779726c6af93320c88a614a26bb934
aae779726c6af93320c88a614a26bb934

size_t GEO_CALL Geo::GeoFRead

...

public: size_t GEO_CALL GeoFRead
(
    void * input,
    size_t size,
    size_t count,
    FILE * file
)

...

A safe alternative to fread.

This guarantees (unless there is an error) to load the entire data. If the number returned does not match the count specified for input, there was a file IO problem.


Anchor
aa1deab18880c882cc71e076b5ce0c871
aa1deab18880c882cc71e076b5ce0c871

int GEO_CALL Geo::GeoFSeek

...

public: int GEO_CALL GeoFSeek
(
    offset_t offset,
    GeoFSeekOrigin origin,
    FILE * file
)

...

A safe alternative to fseek.


Anchor
aa4fb16876adb6507d38c6f360f5ccc69
aa4fb16876adb6507d38c6f360f5ccc69

offset_t GEO_CALL Geo::GeoFTell

...

public: offset_t GEO_CALL GeoFTell
(
    FILE * file
)

...

A safe alternative to ftell.


Anchor
aab11ed516eb9e1d8a3a2be8af1bb1f65
aab11ed516eb9e1d8a3a2be8af1bb1f65

size_t GEO_CALL Geo::GeoFWrite

...

public: size_t GEO_CALL GeoFWrite
(
    const void * output,
    size_t size,
    size_t count,
    FILE * file
)

...

A safe alternative to fwrite.


Anchor
acde6fe8ebe2ff2ead027b9240d1800ab
acde6fe8ebe2ff2ead027b9240d1800ab

bool GEO_CALL Geo::GeoRenameFile

...

public: bool GEO_CALL GeoRenameFile
(
    const char * oldName,
    const char * newName
)

...

Rename a file.


Anchor
a2aa2c7b3ce9b4b0da2b2c5ec27eb267b
a2aa2c7b3ce9b4b0da2b2c5ec27eb267b

const char* GEO_CALL Geo::GetFileSystemPrefix

...

public: const char *GEO_CALL GetFileSystemPrefix()

...

Get the previously set file system prefix for the current platform.


Anchor
a4b31f5bffd85402a3c653c4e97a7f940
a4b31f5bffd85402a3c653c4e97a7f940

void Geo::InvokeFileOpenCallback

...

public: void InvokeFileOpenCallback
(
    const char * path,
    const char * mode
)

...

Invoke the file open callback, if set.


Anchor
adbb4e9aaaf55e30f24a1b8143a11562a
adbb4e9aaaf55e30f24a1b8143a11562a

void* GEO_CALL Geo::LoadFile

...

public: void *GEO_CALL LoadFile
(
    const char * filename,
    u32 & length,
    u32 align,
    u32 extra_alloc
)

...

A safe alternative to ferror.

Load a file returns 0 if this fails the loaded file must be freed using FreeLoadedFile


Anchor
aec8aa0372ecce88f24f1de3c601fbd03
aec8aa0372ecce88f24f1de3c601fbd03

char* GEO_CALL Geo::LoadFileStr

...

public: char *GEO_CALL LoadFileStr
(
    const char * filename,
    u32 & length,
    u32 align
)

...

Load a file and append a null terminator.

The loaded file must be freed using FreeLoadedFile.

Returns

Null if this fails


Anchor
ac31600fd77781454d9c5f8e5d8627932
ac31600fd77781454d9c5f8e5d8627932

bool GEO_CALL Geo::SaveFile

...

public: bool GEO_CALL SaveFile
(
    const char * filename,
    const void * data,
    u32 length
)

...

Save a file.

Returns

False if this fails.


Anchor
a498f04e9f486946bed35131f4e14d3a6
a498f04e9f486946bed35131f4e14d3a6

void Geo::SetFileOpenCallback

...

public: void SetFileOpenCallback
(
    FileOpenCallback callback
)

...

Set the function to be called when a file is opened, or a null pointer to disable the callback.

This has no effect unless GEO_DEVEL is defined!


Anchor
a1c1ad2303a3bbd2a8bb70477b47a642d
a1c1ad2303a3bbd2a8bb70477b47a642d

void GEO_CALL Geo::SetFileSystemPrefix

...

public: void GEO_CALL SetFileSystemPrefix
(
    const char * prefix
)

...

Set a file system prefix for the current platform.

For example, "/app_home" then GeoFOpen "/filename" will open e.g. "/app_home/filename"