Move Config constructor to header.
This commit is contained in:
parent
d99520c2ea
commit
f5c53df354
|
@ -17,6 +17,8 @@
|
|||
#ifndef FEDIPOTATO_CONFIG_HPP
|
||||
#define FEDIPOTATO_CONFIG_HPP
|
||||
|
||||
#include "directories.hpp"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#if __has_include(<filesystem>)
|
||||
|
@ -58,7 +60,13 @@ public:
|
|||
*
|
||||
* @since 0.1.0
|
||||
*/
|
||||
explicit Config(string_view application_name, string_view filename);
|
||||
explicit Config(const string_view application_name,
|
||||
const string_view filename)
|
||||
: _filename{filename}
|
||||
, _filepath{Directories(application_name).config() /= filename}
|
||||
{
|
||||
read();
|
||||
}
|
||||
|
||||
//! Copy constructor
|
||||
Config(const Config &other) = default;
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
|
||||
#include "config.hpp"
|
||||
#include "directories.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
|
@ -27,13 +26,6 @@ using std::ifstream;
|
|||
using std::ofstream;
|
||||
using std::setw;
|
||||
|
||||
Config::Config(const string_view application_name, const string_view filename)
|
||||
: _filename{filename}
|
||||
, _filepath{Directories(application_name).config() /= filename}
|
||||
{
|
||||
read();
|
||||
}
|
||||
|
||||
void Config::read()
|
||||
{
|
||||
if (!fs::exists(_filepath))
|
||||
|
|
Reference in New Issue