7#if __has_include(<filesystem>)
9namespace fs = std::filesystem;
11#include <experimental/filesystem>
12namespace fs = std::experimental::filesystem;
15#include <spdlog/spdlog.h>
17#undef GetCurrentDirectory
32 static std::string GetCurrentDirectory() {
33 return fs::current_path().string();
42 static bool Exists(
const fs::path& path) {
43 return fs::exists(path);
53 static void MakeDirectory(
const std::string& path) {
54 CreateDirectory(path);
61 static void CreateDirectory(
const std::string& path) {
63 fs::create_directories(path);
64 }
catch (
const std::exception& e) { SPDLOG_ERROR(
"Failed to create directory {}: {}", path, e.what()); }
72 static std::vector<std::string> ListFiles(
const std::string& dir) {
73 std::vector<std::string> lst;
76 for (
auto& p : fs::recursive_directory_iterator(dir)) {
77 if (!p.is_directory())
78 lst.push_back(p.path().generic_string());