antara::gaming::config

template<typename TConfig>
TConfig antara::gaming::config::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 = config::load_configuration<my_game::config>(std::filesystem::current_path() / "assets/config", "my_game.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.