vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
project_paths.h
1#pragma once
2
3#include <filesystem>
4#include <string>
5
6namespace Vkm::Engine {
7
18namespace ProjectPaths {
19
28std::filesystem::path engineRoot();
29
38void setProjectRoot(const std::filesystem::path& path);
39
48std::filesystem::path projectRoot();
49
59std::filesystem::path userRoot();
60
73std::filesystem::path playerRoot(const std::string& game);
74
83std::filesystem::path userLogs();
84
94std::filesystem::path resolveProjectPath(const std::string& path);
95
106std::string toProjectRelative(const std::string& path);
107
108// Engine-owned, read-only to a game.
109inline std::filesystem::path engineShaders() { return engineRoot() / "shaders"; }
110inline std::filesystem::path engineAssets() { return engineRoot() / "assets"; }
111inline std::filesystem::path engineFonts() { return engineAssets() / "fonts"; }
113inline std::filesystem::path engineContent() { return engineRoot() / "content"; }
114
120inline std::filesystem::path projectBin() { return projectRoot() / "bin"; }
121
122// Project-owned: the game's own content.
123inline std::filesystem::path assets() { return projectRoot() / "assets"; }
124inline std::filesystem::path scenes() { return projectRoot() / "scenes"; }
125inline std::filesystem::path prefabs() { return projectRoot() / "prefabs"; }
126inline std::filesystem::path envs() { return assets() / "envs"; }
127
128// `library` holds the per-asset recipes (source of truth, version-controlled);
129// `cooked` holds what the cook derives (AssetCook::cacheKey binaries plus manifest).
130inline std::filesystem::path library() { return projectRoot() / "library"; }
131inline std::filesystem::path cooked() { return projectRoot() / "cooked"; }
132inline std::filesystem::path assetManifest() { return cooked() / "_manifest.json"; }
133
134} // namespace ProjectPaths
135
136} // namespace Vkm::Engine
Canonical on-disk locations, split by who owns them.
Definition project_paths.h:18
std::filesystem::path resolveProjectPath(const std::string &path)
Turn a stored reference into a path that can be opened.
std::filesystem::path engineRoot()
Directory holding the engine's own read-only data.
std::filesystem::path engineContent()
The engine's content packs (see ContentPack).
Definition project_paths.h:113
std::filesystem::path userLogs()
Directory a host writes its log to when the project cannot hold one.
void setProjectRoot(const std::filesystem::path &path)
Point the project root at path.
std::filesystem::path projectRoot()
Directory holding the project currently open.
std::filesystem::path userRoot()
Directory this user's own settings live in.
std::filesystem::path projectBin()
Directory the project keeps its built gameplay module in.
Definition project_paths.h:120
std::filesystem::path playerRoot(const std::string &game)
Directory a game keeps its player's own files in: settings, a profile, saves.
std::string toProjectRelative(const std::string &path)
The form of a path an asset should be named and recorded by.