18 size_t dot = filename.find_last_of(
".");
19 if (dot == std::string::npos) {
22 return filename.substr(dot + 1);
26 size_t slash = filename.find_last_of(
"/");
27 if (slash == std::string::npos) {
30 return filename.substr(slash + 1);
36 std::ifstream file(filepath);
38 std::stringstream buffer;
39 buffer << file.rdbuf();
40 contents = buffer.str();
46void SaveFile(
const std::string &filename,
const std::string &contents,
49 std::ofstream file(filepath);
57 std::string config_directory =
".yaze";
60 config_directory =
"~/AppData/Roaming/yaze";
64 config_directory =
"~/.config/yaze";
69 return config_directory;
std::string GetFileName(const std::string &filename)
std::string GetFileExtension(const std::string &filename)
std::string LoadFile(const std::string &filename, Platform platform)
std::string GetConfigDirectory(Platform platform)
void SaveFile(const std::string &filename, const std::string &contents, Platform platform)