vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::ProjectPaths Namespace Reference

Canonical on-disk locations, split by who owns them. More...

Functions

std::filesystem::path engineRoot ()
 Directory holding the engine's own read-only data.
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 userLogs ()
 Directory a host writes its log to when the project cannot hold one.
std::filesystem::path resolveProjectPath (const std::string &path)
 Turn a stored reference into a path that can be opened.
std::string toProjectRelative (const std::string &path)
 The form of a path an asset should be named and recorded by.
std::filesystem::path projectBin ()
 Directory the project keeps its built gameplay module in.

Detailed Description

Canonical on-disk locations, split by who owns them.

  • engineRoot() ships with the engine and is read-only: an installed SDK is not writable, so nothing the engine produces is addressed from here.
  • projectRoot() is the game: scenes, art, the asset library, the cooked cache.
  • userRoot() is one person's tool settings, across projects and installs.

Project or user is the question "would you commit this?"

Function Documentation

◆ engineRoot()

std::filesystem::path Vkm::Engine::ProjectPaths::engineRoot ( )

Directory holding the engine's own read-only data.

Beside the executable or one level up when packaged; otherwise the repo root recorded at configure time.

Returns
Absolute path to the engine root.

◆ setProjectRoot()

void Vkm::Engine::ProjectPaths::setProjectRoot ( const std::filesystem::path & path)

Point the project root at path.

Set before anything composes a project path: a path already built from the old root will not follow.

Parameters
pathDirectory containing the project's project.json.

◆ projectRoot()

std::filesystem::path Vkm::Engine::ProjectPaths::projectRoot ( )

Directory holding the project currently open.

The path set by setProjectRoot(), else the engine root (a checkout is its own project; a packaged game keeps its data beside the executable).

Returns
Absolute path to the project root.

◆ userRoot()

std::filesystem::path Vkm::Engine::ProjectPaths::userRoot ( )

Directory this user's own settings live in.

A vkmEngine folder under $XDG_CONFIG_HOME (or ~/.config) or APPDATA%; the engine root when there is no home or the folder cannot be created. Exists when this returns; resolved once.

Returns
Absolute path to the user's vkmEngine settings directory.

◆ userLogs()

std::filesystem::path Vkm::Engine::ProjectPaths::userLogs ( )

Directory a host writes its log to when the project cannot hold one.

Under $XDG_STATE_HOME (or ~/.local/state) or LOCALAPPDATA%: a log is state, not settings, and should not roam. Not created here; see bootHost.

Returns
Absolute path to the user's vkmEngine log directory.

◆ resolveProjectPath()

std::filesystem::path Vkm::Engine::ProjectPaths::resolveProjectPath ( const std::string & path)

Turn a stored reference into a path that can be opened.

A relative reference resolves against the project root, never the working directory (bootHost pins that to the engine root). An absolute one passes through.

Parameters
pathReference as stored in a scene, a recipe or an asset name.
Returns
An absolute path.

◆ toProjectRelative()

std::string Vkm::Engine::ProjectPaths::toProjectRelative ( const std::string & path)

The form of a path an asset should be named and recorded by.

Project-relative when under the project root, so identities do not carry the authoring machine's tree; absolute otherwise. Always generic-separated, so a reference authored on Windows resolves elsewhere.

Parameters
pathAbsolute or relative path to a source file or folder.
Returns
The reference to store.

◆ projectBin()

std::filesystem::path Vkm::Engine::ProjectPaths::projectBin ( )
inline

Directory the project keeps its built gameplay module in.

Returns
Absolute path to the project's binary directory.