YourGameLib
Loading...
Searching...
No Matches
Namespaces | Functions
file.cpp File Reference
#include <string>
#include <vector>
#include "dirent.h"
#include <android_native_app_glue.h>
#include <android/asset_manager.h>
#include "yourgame_internal/file.h"
Include dependency graph for file.cpp:

Namespaces

namespace  yourgame_internal
 
namespace  yourgame_internal::file
 
namespace  yourgame_internal::file::android
 
namespace  yourgame
 
namespace  yourgame::file
 file and path related functions
 

Functions

void yourgame_internal::file::android::initFile (struct android_app *app)
 
std::string yourgame::file::getAssetFilePath (const std::string &pathRelative="")
 returns the full (absolut) path to the assets directory, extended by pathRelative
 
std::string yourgame::file::getBasePath (const std::string &pathRelative="")
 returns the full (absolut) path to the executable (base), extended by pathRelative
 
std::string yourgame::file::getProjectFilePath (const std::string &pathRelative="")
 returns the full (absolut) path to the current project directory, extended by pathRelative
 
int yourgame::file::readAssetFile (const std::string &filename, std::vector< uint8_t > &dst)
 reads an entire file (from asset file location) and returns it as a vector of bytes
 
int yourgame::file::readProjectFile (const std::string &filename, std::vector< uint8_t > &dst)
 reads an entire file (from project file location) and returns it as a vector of bytes
 
int yourgame::file::writeAssetFile (const std::string &filename, const void *data, size_t numBytes)
 writes numBytes bytes from data to a file called filename in the asset file location. overwrites the file if it exists
 
int yourgame::file::writeProjectFile (const std::string &filename, const void *data, size_t numBytes)
 writes numBytes bytes from data to a file called filename in the project file location. overwrites the file if it exists
 
void yourgame::file::setProjectPath (const std::string &path)
 sets path as current project directory
 
std::vector< std::string > yourgame::file::ls (const std::string &pattern)
 returns list of directory content. accepts prefixes like readFile() does. accepts wildcard "*" for files (after last / in pattern)