mirror of
https://github.com/zeldaret/oot
synced 2026-09-06 10:55:27 -04:00
493bdbc3c6
subrepo: subdir: "tools/ZAPD" merged: "4751db5c9" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "4751db5c9" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596"
40 lines
790 B
C++
40 lines
790 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#if __has_include(<filesystem>)
|
|
#include <filesystem>
|
|
namespace fs = std::filesystem;
|
|
#else
|
|
#include <experimental/filesystem>
|
|
namespace fs = std::experimental::filesystem;
|
|
#endif
|
|
|
|
#include "StringHelper.h"
|
|
|
|
class Directory
|
|
{
|
|
public:
|
|
static std::string GetCurrentDirectory() { return fs::current_path().u8string(); }
|
|
|
|
static bool Exists(const std::string& path) { return fs::exists(fs::path(path)); }
|
|
|
|
static void CreateDirectory(const std::string& path)
|
|
{
|
|
std::string curPath = "";
|
|
std::vector<std::string> split = StringHelper::Split(path, "/");
|
|
|
|
for (std::string s : split)
|
|
{
|
|
curPath += s + "/";
|
|
|
|
if (!Exists(curPath))
|
|
fs::create_directory(curPath);
|
|
}
|
|
|
|
// fs::create_directory(path);
|
|
}
|
|
};
|