YourGameLib
Loading...
Searching...
No Matches
Namespaces | Functions
file.cpp File Reference
#include <algorithm>
#include <regex>
#include <cstdint>
#include <cstdio>
#include <vector>
#include <string>
#include "dirent.h"
#include "miniz.h"
#include "yourgame/file.h"
#include "yourgame/log.h"
Include dependency graph for file.cpp:

Namespaces

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

Functions

int yourgame_internal::file::readFileFromPath (const std::string &filepath, std::vector< uint8_t > &dst)
 
int yourgame_internal::file::readFileFromArchive (const std::string &archivepath, const std::string &filename, std::vector< uint8_t > &dst)
 
int yourgame_internal::file::writeFileToPath (const std::string &filepath, const void *data, size_t numBytes)
 
bool yourgame_internal::file::checkIfPathIsDirectory (const std::string &filepath)
 
void yourgame_internal::file::normalizePath (std::string &path)
 
int yourgame::file::readFile (const std::string &filename, std::vector< uint8_t > &dst)
 reads an entire file and returns it as a vector of bytes
 
std::string yourgame::file::getFileLocation (const std::string &filepath)
 returns the location (path or prefix, such as a//) of a file, filepath points to
 
std::string yourgame::file::getFileName (const std::string &filepath)
 returns the actual file name of a file, filepath points to
 
std::string yourgame::file::getFileNameWithoutExtension (const std::string &filepath)
 returns the actual file name (w/o file extension) of a file, filepath points to
 
std::string yourgame::file::getFileExtension (const std::string &filepath)
 returns the file extension
 
int yourgame::file::writeFile (const std::string &filename, const void *data, size_t numBytes)
 writes numBytes bytes from data to a file called filename, destination path determined by prefix ("a//", etc.), see readFile(). overwrites the file if it exists.