#pragma once #include #include #include #ifdef USE_BOOST_FS #include namespace fs = boost::filesystem; #elif __has_include() #include namespace fs = std::filesystem; #else #include namespace fs = std::experimental::filesystem; #endif #include "StringHelper.h" class Directory { public: #ifdef USE_BOOST_FS static std::string GetCurrentDirectory() { return fs::current_path().string(); } #else static std::string GetCurrentDirectory() { return fs::current_path().u8string(); } #endif static bool Exists(const fs::path& path) { return fs::exists(path); } static void CreateDirectory(const std::string& path) { std::string curPath; std::vector split = StringHelper::Split(path, "/"); for (std::string s : split) { curPath += s + "/"; if (!Exists(curPath)) fs::create_directory(curPath); } // fs::create_directory(path); } };