ASGE  3.2.0
Simple Game Framework in GL
ASGE::FILEIO Namespace Reference

Classes

struct  IOBuffer
 
struct  File
 

Functions

bool setWriteDir (const std::string &dir, bool mount)
 
bool createDir (const std::string &dir)
 
void printFiles (std::string &&dir)
 
std::vector< std::string > enumerateFiles (const std::string &dir)
 
bool mount (const std::string &dir, const std::string &mount_point)
 
bool deleteFile (const std::string &filename)
 

Detailed Description

input and output resource management

Function Documentation

◆ createDir()

bool ASGE::FILEIO::createDir ( const std::string &  dir)

Creates a subdirectory in the root of the write directory.

Will attempt to create a subdirectory inside the writeable root. Ensure that the FileIO subsystem is initialised and that a write directory is set (if not using the default).

Parameters
[in]dirThe directory to list.
Returns
False if the directory can't be created.

◆ deleteFile()

bool ASGE::FILEIO::deleteFile ( const std::string &  filename)

Attempts to delete a file.

Deletes a file using the mounted pseudo-fs. Warning; make sure you specify the correct file for deletion.

Parameters
[in]filenameFile to delete.
Returns
Success.

◆ enumerateFiles()

std::vector<std::string> ASGE::FILEIO::enumerateFiles ( const std::string &  dir)

Lists all files in a given directory.

Generates a list of strings representing each file in a given directory. The search is performed in the pseudo-filesystem and does not conform to the local directories.

Parameters
[in]dirThe directory to search.
Returns
A vector of strings, one per file found.

◆ mount()

bool ASGE::FILEIO::mount ( const std::string &  dir,
const std::string &  mount_point 
)

Mounts a real directory into the pseudo-fs.

Mount a directory in the file system to reside within the pseudo-fs. All mount points exist below the root /data

Parameters
[in]dirThe directory to mount.
[in]mount_pointThe mount point to reside below /data/
Returns
True if successful.

◆ printFiles()

void ASGE::FILEIO::printFiles ( std::string &&  dir)

Prints files stored in a given directory using the ASGE file IO subsystem. This does not list files outside of the virtual mounted paths.

Parameters
[in]dirThe directory to list.

◆ setWriteDir()

bool ASGE::FILEIO::setWriteDir ( const std::string &  dir,
bool  mount 
)

Sets the base directory for saving files.

This directory will be used as the root for any files being written to or saved. For obvious reasons, you should look to use a directory different to the gamedata directory. If the folder does not exist or the file subsystem is not initialised then this will fail. The user must have read/write access to the directory for saving to work. It is recommended that the directory used is free of important files.

Parameters
dirThe root directory for saving files.
Returns
Whether the directory was set successfully or not.