6#include "../StringHelper.h"
8#if __has_include(<filesystem>)
10namespace fs = std::filesystem;
12#include <experimental/filesystem>
13namespace fs = std::experimental::filesystem;
26 static std::string GetFileName(
const fs::path& input) {
28 return input.filename().string();
36 static std::string GetFileNameWithoutExtension(
const fs::path& input) {
38 return input.stem().string();
47 static std::string GetFileNameExtension(
const std::string& input) {
48 auto pos = input.find_last_of(
".");
49 if (pos == std::string::npos) {
50 throw std::out_of_range(
"GetFileNameExtension: no '.' found in \"" + input +
"\"");
52 return input.substr(pos);
60 static fs::path GetPath(
const std::string& input) {
61 std::vector<std::string> split = StringHelper::Split(input,
"/");
64 for (std::string str : split) {
65 if (str.find_last_of(
".") == std::string::npos)
77 static fs::path GetDirectoryName(
const fs::path& path) {
78 return path.parent_path();