CoriEngine
Loading...
Searching...
No Matches
PathManager.hpp
Go to the documentation of this file.
1#pragma once
2#include <filesystem>
3#include <unordered_map>
4
5namespace Cori {
6 namespace Core {
7 class Application;
8 }
9
10 namespace FileSystem {
111 class PathManager {
112 public:
118 static std::filesystem::path GetAliasedPath(const std::string& alias);
119
125 static std::filesystem::path GetAliasedPath(const std::string_view alias);
126
132 static std::filesystem::path GetAliasedPath(const char* alias);
133
134 private:
135 PathManager();
136
137 static PathManager& Get() {
138 static PathManager s_Instance;
139 return s_Instance;
140 }
141
142 friend Core::Application;
143
144 struct TransparentHash {
145 using is_transparent = void;
146
147 size_t operator()(std::string_view sv) const noexcept {
148 return std::hash<std::string_view>{}(sv);
149 }
150 };
151
152 struct TransparentEqual {
153 using is_transparent = void;
154
155 bool operator()(std::string_view lhs, std::string_view rhs) const noexcept {
156 return lhs == rhs;
157 }
158 };
159
160 std::unordered_map<std::string, std::filesystem::path, TransparentHash, TransparentEqual> m_AliasedPaths;
161 };
162 }
163}
Main Application object, there can only be one Application object. Basically a root of the program.
static std::filesystem::path GetAliasedPath(const std::string &alias)
Retries the full aliased path defined in fsgame.json.
Core systems of the engine are here.
Everything connected to interacting with files and filesystem is in this namespace.
Global engine namespace.