Files
mm/tools/ZAPD/ZAPDUtils/Utils/Directory.h
T
louist103 a5400fbde5 Update ZAPD (#1533)
* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "2b6f459b9"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "2b6f459b9"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"

* Update ZAPD

Co-authored-by: Yanis42 <35189056+Yanis42@users.noreply.github.com>

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "572b13236"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "572b13236"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "9601f2699"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "9601f2699"
git-subrepo:
  version:  "0.4.6"
  origin:   "???"
  commit:   "???"

* fixes for new ZAPD

* readd typedefs

* remov enums

* Reading is hard

---------

Co-authored-by: Yanis42 <35189056+Yanis42@users.noreply.github.com>
2024-01-14 12:34:50 -03:00

56 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);
}
};