20#ifndef YOURGAME_FILE_H
21#define YOURGAME_FILE_H
39 int readFile(
const std::string &filename, std::vector<uint8_t> &dst);
42 int readAssetFile(
const std::string &filename, std::vector<uint8_t> &dst);
45 int readProjectFile(
const std::string &filename, std::vector<uint8_t> &dst);
50 int writeFile(
const std::string &filename,
const void *data,
size_t numBytes);
54 int writeAssetFile(
const std::string &filename,
const void *data,
size_t numBytes);
58 int writeProjectFile(
const std::string &filename,
const void *data,
size_t numBytes);
64 std::string
getBasePath(
const std::string &pathRelative =
"");
84 std::string
getFileName(
const std::string &filepath);
108 std::vector<std::string>
ls(
const std::string &pattern);
std::vector< std::string > ls(const std::string &pattern)
returns list of directory content. accepts prefixes like readFile() does. accepts wildcard "*" for fi...
Definition file.cpp:101
int 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/...
Definition file.cpp:195
int 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....
Definition file.cpp:92
int 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
Definition file.cpp:82
std::string getAssetFilePath(const std::string &pathRelative="")
returns the full (absolut) path to the assets directory, extended by pathRelative
Definition file.cpp:50
int 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....
Definition file.cpp:87
int 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
Definition file.cpp:65
std::string getFileName(const std::string &filepath)
returns the actual file name of a file, filepath points to
Definition file.cpp:153
std::string getFileNameWithoutExtension(const std::string &filepath)
returns the actual file name (w/o file extension) of a file, filepath points to
Definition file.cpp:166
std::string getFileExtension(const std::string &filepath)
returns the file extension
Definition file.cpp:182
std::string getProjectFilePath(const std::string &pathRelative="")
returns the full (absolut) path to the current project directory, extended by pathRelative
Definition file.cpp:60
int readFile(const std::string &filename, std::vector< uint8_t > &dst)
reads an entire file and returns it as a vector of bytes
Definition file.cpp:118
std::string getBasePath(const std::string &pathRelative="")
returns the full (absolut) path to the executable (base), extended by pathRelative
Definition file.cpp:55
std::string getFileLocation(const std::string &filepath)
returns the location (path or prefix, such as a//) of a file, filepath points to
Definition file.cpp:134
void setProjectPath(const std::string &path)
sets path as current project directory
Definition file.cpp:97