12#ifndef INCLUDE_ARK_FILES_HPP
13#define INCLUDE_ARK_FILES_HPP
33 return std::filesystem::exists(std::filesystem::path(name));
35 catch (
const std::filesystem::filesystem_error&)
48 inline std::string
readFile(
const std::string& name)
50 std::ifstream f(name.c_str());
53 (std::istreambuf_iterator<char>(f)),
54 std::istreambuf_iterator<char>());
65 return (std::filesystem::path(path)).parent_path().string();
76 return (std::filesystem::path(path)).filename().string();
87 return std::filesystem::relative(std::filesystem::path(path)).generic_string();
std::string readFile(const std::string &name)
Helper to read a file.
bool fileExists(const std::string &name) noexcept
Checks if a file exists.
std::string canonicalRelPath(const std::string &path)
Get the canonical relative path from a path.
std::string getDirectoryFromPath(const std::string &path)
Get the directory from a path.
std::string getFilenameFromPath(const std::string &path)
Get the filename from a path.