mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-15 06:06:04 +00:00
4e55168eaa
* git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "094e79734" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "094e79734" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "110b9eb" * Add EnumData.xml where some names are now externalized * Remove legacy typedefs for zapd, no longer needed!
55 lines
987 B
C++
55 lines
987 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#ifdef USE_BOOST_FS
|
|
#include <boost/filesystem.hpp>
|
|
namespace fs = boost::filesystem;
|
|
#elif __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:
|
|
#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<std::string> split = StringHelper::Split(path, "/");
|
|
|
|
for (std::string s : split)
|
|
{
|
|
curPath += s + "/";
|
|
|
|
if (!Exists(curPath))
|
|
fs::create_directory(curPath);
|
|
}
|
|
|
|
// fs::create_directory(path);
|
|
}
|
|
};
|