6#include "../StringHelper.h"
8#if __has_include(<filesystem>)
10namespace fs = std::filesystem;
12#include <experimental/filesystem>
13namespace fs = std::experimental::filesystem;
31 return input.filename().string();
41 return input.stem().string();
51 auto pos = input.find_last_of(
".");
52 if (pos == std::string::npos) {
53 throw std::out_of_range(
"GetFileNameExtension: no '.' found in \"" + input +
"\"");
55 return input.substr(pos);
63 static fs::path
GetPath(
const std::string& input) {
64 std::vector<std::string> split = StringHelper::Split(input,
"/");
67 for (std::string str : split) {
68 if (str.find_last_of(
".") == std::string::npos) {
82 return path.parent_path();
Utility class providing static helpers for extracting components from filesystem paths.
Definition PathHelper.h:22
static fs::path GetDirectoryName(const fs::path &path)
Returns the parent directory of the given path.
Definition PathHelper.h:81
static std::string GetFileNameExtension(const std::string &input)
Returns the file extension including the leading dot.
Definition PathHelper.h:50
static std::string GetFileNameWithoutExtension(const fs::path &input)
Returns the filename without its extension (stem).
Definition PathHelper.h:39
static fs::path GetPath(const std::string &input)
Extracts the directory portion of a slash-separated path, stripping segments that contain a dot.
Definition PathHelper.h:63
static std::string GetFileName(const fs::path &input)
Returns the filename component of a path (including extension).
Definition PathHelper.h:29
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14