9 #if __has_include(<filesystem>)
11 #elif __has_include(<experimental/filesystem>)
12 #include <experimental/filesystem>
14 #pragma message("Warning: Your compiler does not support the filesystem library. Please report this incident to the Cytopia Team")
19 #if __has_include(<filesystem>)
20 using namespace std::filesystem;
21 #elif __has_include(<experimental/filesystem>)
22 using namespace std::experimental::filesystem;
28 for (
const auto &fp : fs::directory_iterator(path))
30 if (
static_cast<fs::path
>(fp).extension() == extension)
44 std::ios::openmode mode;
46 mode = std::ios_base::in | std::ios_base::binary;
49 mode = std::ios_base::in;
56 stream.open(fileName, mode);
72 std::stringstream buffer;
73 buffer << stream.rdbuf();
86 std::ios::openmode mode;
89 mode = std::ios_base::out | std::ios_base::binary;
93 mode = std::ios_base::out;
96 std::ofstream stream(fileName, mode);
103 stream << stringToWrite << std::endl;
109 std::vector<std::string> dirContent;
111 pathToSaveFiles.append(directory);
112 for (
const auto &it : fs::directory_iterator(fs::path(pathToSaveFiles)))
114 dirContent.emplace_back(
static_cast<path
>(it).
string());
121 std::vector<std::string> saveGames;
123 [&saveGames](
const auto &path) { saveGames.emplace_back(
static_cast<fs::path
>(path).
string()); });
133 char *path = SDL_GetBasePath();
149 if (!fs::is_directory(dir))
151 if (fs::create_directories(dir.c_str()))