Defile

A wrapper of the PhysicsFS library, specifically via the DerelictPHYSFS binding.

In some cases, the methods of Defile directly wrap PhysicsFS functions, doing nothing more than converting between C and D types and throwing exceptions when a call fails. Other methods are for convenience, wrapping multiple PhysicsFS function calls into a single method. For more information on the details of the wrapped PhysicsFS functions, please refer either to the PHYSFS documentation or physfs.h.

Note that the static methods below either wrap functions that work with global state or serve as covenience methods that eliminate the need to deal with an indivdual file. The nonstatic methods wrap functions that manipulate files directly.

Constructors

this
this(string fileName, OpenFor ofor)

Opens a file when it is constructed.

Destructor

~this
~this()

Closes a file when it goes out of scope.

Members

Functions

bufferSize
void bufferSize(size_t size)

A wrapper for PHYSFS_setBuffer.

close
void close()

A wrapper for PHYSFS_close.

eof
bool eof()

A wrapper for PHYSFS_eof.

flush
void flush()

A wrapper for PHYSFS_flush.

length
size_t length()

A wrapper for PHYSFS_fileLength.

open
void open(string fileName, OpenFor ofor)

A wrapper for PHYSFS_openRead, PHYSFS_openWrite, and PHYSFS_openAppend.

read
size_t read(ref ubyte[] buffer, size_t objSize, size_t objCount)

A wrapper for PHYSFS_read.

read
size_t read(void* ptr, size_t objSize, size_t objCount)

A wrapper for PHYSFS_read.

readBE
T readBE()

A templated wrapper for the PHYSFS_readSBE/UBE* functions.

readLE
T readLE()

A templated wrapper for the PHYSFS_readSLE/ULE* functions.

seek
void seek(size_t position)

A wrapper for PHYSFS_seek.

tell
size_t tell()

A wrapper for PHYSFS_tell.

write
size_t write(const(ubyte)[] buffer, size_t objSize, size_t objCount)

A wrapper for PHYSFS_write.

write
size_t write(const(void)* ptr, size_t objSize, size_t objCount)

A wrapper for PHYSFS_write.

writeBE
void writeBE(T val)

A templated wrapper for the PHYSFS_writeSBE/UBE* functions.

writeLE
void writeLE(T val)

A templated wrapper for the PHYSFS_writeSLE/ULE* functions.

Static functions

baseDir
string baseDir()
createWriteDir
void createWriteDir(string organization, string appName)

Creates the application write directory.

exists
bool exists(string filePath)

A wrapper for PHYSFS_exists.

findFilePath
string findFilePath(string fileName)

Searches for a given file in the write and base directories and, if it exists, returns a path to the file.

initialize
void initialize()

Must be called before any other methods.

lastError
string lastError()

A wrapper for PHYSFS_getLastError().

makeFilePath
string makeFilePath(PathType which, string fileName)

A convenience function which creates a path string to a file in a specific directory.

mkdir
void mkdir(string dirPath)

A wrapper for PHYSFS_mkdir.

mount
void mount(string newDir, string mountPoint = "", MountAction action = MountAction.append)

A weapper for PHYSFS_mount.

readFile
size_t readFile(string filePath, ref ubyte[] buffer)

A covenience function that reads the entire content of a file in a single method call.

remove
void remove(string path)

A wrapper for PHYSFS_delete.

searchPath
string[] searchPath()
terminate
void terminate()

Should be called before the application exits.

writeDir
string writeDir()
writeDir
void writeDir(string dir)

Sets the current write directory.

writeFile
size_t writeFile(string filePath, ubyte[] buffer)

A convenience function that writes an entire buffer to a file in a single method call.

Meta