ORE Studio 0.0.4
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
project_root Class Reference

Provides access to project root directory for test resource location. More...

#include <project_root.hpp>

Collaboration diagram for project_root:
Collaboration graph

Static Public Member Functions

static std::filesystem::path get ()
 Returns the absolute path to the project root directory.
 
static std::filesystem::path resolve (const std::filesystem::path &relative_path)
 Resolves a project-relative path to an absolute path.
 

Detailed Description

Provides access to project root directory for test resource location.

This helper finds the project root by walking up from the current working directory looking for a .git directory. Tests can use this to locate resources using project-relative paths, avoiding fragile relative paths like "../../../".

Member Function Documentation

◆ get()

std::filesystem::path get ( )
static

Returns the absolute path to the project root directory.

Searches upward from the current working directory for a directory containing .git. The result is cached after the first call.

Exceptions
std::runtime_errorif .git directory cannot be found.
Here is the caller graph for this function:

◆ resolve()

std::filesystem::path resolve ( const std::filesystem::path &  relative_path)
static

Resolves a project-relative path to an absolute path.

Parameters
relative_pathPath relative to the project root (e.g., "external/ore/examples")
Returns
Absolute path to the resource
Exceptions
std::runtime_errorif project root cannot be found.