28 #ifndef YGGDRASILWM_CONFIGFILEHANDLER_H
29 #define YGGDRASILWM_CONFIGFILEHANDLER_H
33 #include "json/json.h"
94 static bool fileExists(
const std::string &path);
Handle file I/O and JSON parsing for the configuration file. If no path is provided,...
Definition: ConfigFileHandler.hpp:40
void readConfig()
Read the configuration file Store the JSon root object in Json::Value root_ Throws exceptions in case...
Definition: ConfigFileHandler.cpp:75
Json::Value root_
Definition: ConfigFileHandler.hpp:81
~ConfigFileHandler()
Definition: ConfigFileHandler.cpp:54
const Json::Value & getRoot()
Get the root JSON object.
Definition: ConfigFileHandler.cpp:101
ConfigFileHandler()
Construct a new ConfigFileHandler object without a path.
Definition: ConfigFileHandler.cpp:36
std::string configPath_
Definition: ConfigFileHandler.hpp:80
void writeConfig(const Json::Value &root)
Write the configuration file Store the JSon root object in the configPath file Throws exceptions in c...
Definition: ConfigFileHandler.cpp:87
static std::string expandEnvironmentVariables(const std::string &path)
Expand environment variables in a path.
Definition: ConfigFileHandler.cpp:67
static const std::vector< std::string > defaultPaths
Definition: ConfigFileHandler.hpp:79
static std::string findConfigFile()
Find the configuration file in the default paths.
Definition: ConfigFileHandler.cpp:59
std::string getConfigPath()
Definition: ConfigFileHandler.cpp:103
static bool fileExists(const std::string &path)
Check if a file exists by trying to open it.
Definition: ConfigFileHandler.cpp:55