xentara-plugin v2.0.4
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::config::Context::FindExternalConfigOptions Struct Referencefinal

Options for findExternalConfig() More...

#include <xentara/config/Context.hpp>

Public Attributes

std::filesystem::path subdirectory
 The configuration subdirectory to use, or an empty string for none.
 
std::filesystem::file_type fileType
 The type of file system entry to look for (file, directory, etc.)
 
bool allowMissing
 Whether to allow a missing path.
 
bool useFallback
 Whether to return a fallback path if the path does not exist.
 
std::optional< std::reference_wrapper< std::filesystem::path > > configDirectory
 Variable to receive the configuration directory where a relative path was found.
 

Detailed Description

Member Data Documentation

◆ allowMissing

bool xentara::config::Context::FindExternalConfigOptions::allowMissing

Whether to allow a missing path.

If this option is enabled, findExternalConfig() will return an empty path if the configuration is not found.

This option cannot be used together with useFallback.

◆ configDirectory

std::optional<std::reference_wrapper<std::filesystem::path> > xentara::config::Context::FindExternalConfigOptions::configDirectory

Variable to receive the configuration directory where a relative path was found.

This option can be set to a variable that will receive the exact configuration directory that the returned path is located in. This is only relevant for relative paths, where several directories are searched. The variable will be set to the base bath, without subdirectory, where the found configuration is located. This will be a path like /home/xentara/.config/xentara, /etc/xdg/xentara, C:\Users\Xentara\AppData\Local\Xentara\Config, or C:\ProgramData\Xentara\Config.

You can use this path to look for related configurations that must be located beneath the same configuration directory. The class security::CertificatePaths uses this, for example, to ensure that the certificate and the private key are located within the same configuration directory.

If the path was an absolute path, then the variable is set to an empty path. If findExternalConfig() returns std::nullopt or throws an error, the variable is not modified.

◆ fileType

std::filesystem::file_type xentara::config::Context::FindExternalConfigOptions::fileType

The type of file system entry to look for (file, directory, etc.)

Use this option to search for configurations that are not regular files. You can use this option, for example, to search for a directory rather than a file by specifying std::filesystem::file_type::directory as file type. To switch file type checking off altogether, specify std::filesystem::file_type::none for this option.

This option must not be set to std::filesystem::file_type::not_found.

◆ subdirectory

std::filesystem::path xentara::config::Context::FindExternalConfigOptions::subdirectory

The configuration subdirectory to use, or an empty string for none.

Use this option to specify a configuration subdirectory, as described under Configuration Sub Directories in the Xentara user manual. If you specify an empty path (the default), no configuration subdirectory will be used.

This path is relative to the Xentara configuration directory, so the subdirectory component “xentara” (Linux) or “Xentara\Config” (Windows) should not be included.

◆ useFallback

bool xentara::config::Context::FindExternalConfigOptions::useFallback

Whether to return a fallback path if the path does not exist.

If this option is enabled, findExternalConfig() will return a fallback path if the configuration is not found. For absolute paths, the fallback is just the path itself. For relative paths, the fallback is the path relative to the first suitable config directory.

This option cannot be used together with allowMissing.