CPGen
C++ project generator
Loading...
Searching...
No Matches
Functions
PathResolver Namespace Reference

Functions

std::filesystem::path executablePath ()
 Resolve the absolute path of the running executable.
 
std::vector< std::filesystem::path > resolveTemplatePaths ()
 Build the ordered list of template search directories.
 
std::filesystem::path findTemplatesRoot ()
 Return the first existing template root directory.
 

Function Documentation

◆ executablePath()

std::filesystem::path PathResolver::executablePath ( )

Resolve the absolute path of the running executable.

Uses /proc/self/exe on Linux. Returns an empty path if the symlink cannot be read.

Returns
Absolute path to the running executable, or empty on failure.
Here is the caller graph for this function:

◆ findTemplatesRoot()

std::filesystem::path PathResolver::findTemplatesRoot ( )

Return the first existing template root directory.

Convenience wrapper around resolveTemplatePaths that returns just the highest-priority path.

Returns
Absolute path to the best template root.
Exceptions
std::runtime_errorIf no candidate directory is found.
Here is the call graph for this function:

◆ resolveTemplatePaths()

std::vector< std::filesystem::path > PathResolver::resolveTemplatePaths ( )

Build the ordered list of template search directories.

Only directories that actually exist on disk are included.

Returns
Non-empty vector of existing template root directories.
Exceptions
std::runtime_errorIf no candidate directory is found.
Here is the call graph for this function:
Here is the caller graph for this function: