Vulkan Schnee 0.0.1
High-performance rendering engine
Loading...
Searching...
No Matches
Path.h
Go to the documentation of this file.
1#pragma once
2#include <string>
3#include <filesystem>
4
5namespace EngineCore {
6
8 {
9 public:
10 constexpr explicit ConstexprPath(std::string_view path) : path(path) {}
11
12 explicit operator std::filesystem::path() const { return path; }
13
14 std::filesystem::path operator/(const std::filesystem::path & other ) const
15 {
16 return path / other;
17 }
18
19 std::filesystem::path operator/(std::string_view other) const {
20 return std::filesystem::path(path) / other;
21 }
22
23 std::filesystem::path operator/(const char* other) const {
24 return std::filesystem::path(path) / other;
25 }
26
27 [[nodiscard]] constexpr std::string_view view() const { return path; }
28 private:
29 std::string_view path;
30 };
31
32 class Path {
33 public:
34 static std::string getEngineRoot();
35
39 static constexpr std::string getProjectRoot();
45 static constexpr ConstexprPath engineGeometry() {
46 return ConstexprPath( "assets/Engine/geometry/" );
47 }
48
53 static constexpr ConstexprPath engineShaders() {
54 return ConstexprPath( "assets/Engine/shaders/" );
55 }
56
61 static constexpr ConstexprPath engineTextures() {
62 return ConstexprPath( "assets/Engine/textures/" );
63 }
64
65 static bool doesFileExist(const std::filesystem::path &path);
66 static bool doesGltfFileExist(const std::filesystem::path &path);
67 static bool doesExrFileExist(const std::filesystem::path &path);
68 };
69
70}
std::string_view path
Definition Path.h:29
std::filesystem::path operator/(const std::filesystem::path &other) const
Definition Path.h:14
std::filesystem::path operator/(const char *other) const
Definition Path.h:23
constexpr std::string_view view() const
Definition Path.h:27
std::filesystem::path operator/(std::string_view other) const
Definition Path.h:19
constexpr ConstexprPath(std::string_view path)
Definition Path.h:10
static std::string getEngineRoot()
Definition Path.cpp:5
static constexpr ConstexprPath engineTextures()
Path to engine textures @lsp_source_path Engine/textures.
Definition Path.h:61
static bool doesFileExist(const std::filesystem::path &path)
Definition Path.cpp:15
static bool doesGltfFileExist(const std::filesystem::path &path)
Definition Path.cpp:19
static bool doesExrFileExist(const std::filesystem::path &path)
Definition Path.cpp:23
static constexpr ConstexprPath engineShaders()
Path to engine shaders @lsp_source_path Engine/shaders.
Definition Path.h:53
static constexpr std::string getProjectRoot()
Gets the root location of the whole game. This is.
Definition Path.cpp:9
static constexpr ConstexprPath engineGeometry()
Path to engine geometry assets @lsp_source_path Engine/geometry/Defaults @lsp_source_path Engine/geom...
Definition Path.h:45
Log category system implementation.