nephtys::utils

template<typename TConfig>
TConfig nephtys::utils::load_configuration(std::filesystem::path &&config_path, std::string filename)

This function allows us to load a configuration through a path and filename. There are three different behaviors in this function:

  • if the parameter path does not exist the function will attempt to create the directories of the given path.

  • if the configuration does not exist a default one will be created.

  • if the path and the name of the file exists, the contents of the configuration will be loaded.

Example:

auto cfg = utils::load_configuration<client::config>(std::filesystem::current_path() / "assets/config", "nephtys_client.config.json");
Return

a loaded/created configuration.

Template Parameters
  • TConfig: the type of template you want to load

Parameters
  • config_path: the path to the configuration you want to load

  • filename: the name of the configuration you want to load.