10namespace fs = std::filesystem;
17#define PARENT_LIB "library"
18#define PARENT_LIB_FIELD_NAME "name"
19#define PARENT_LIB_FIELD_DIR "directory"
21#define PARENT_FTP "ftp"
22#define PARENT_FTP_FIELD_USER "username"
23#define PARENT_FTP_FIELD_SALT "salt"
24#define PARENT_FTP_FIELD_PWD_HASH "password_hash"
26#define PARENT_DBG "debug"
27#define PARENT_DBG_FIELD_PARSER_LOG "parser_log"
30#define PARENT_KEYBINDS "keybinds"
31#define SPECIAL_KEYBIND_ENTER_STR "Enter"
32#define SPECIAL_KEYBIND_TAB_STR "Tab"
33#define SPECIAL_KEYBIND_SPACE_STR "Space"
35#define PARENT_COLORS "colors"
50 const char* homeDir = std::getenv(
"HOME");
53 cerr <<
"ERROR: HOME environment variable not found." << endl;
58 string configFilePath = string(homeDir) +
"/.config/inLimbo/" + fileName;
59 return configFilePath;
64 const char* homeDir = std::getenv(
"HOME");
67 cerr <<
"ERROR: HOME environment variable not found." << endl;
71 string cacheFilePath = string(homeDir) +
"/.cache/inLimbo/";
101 cerr <<
"ERROR: config.toml not found in " << configFilePath << endl;
105 return toml::parse_file(configFilePath);
123 return config[parent][field].value_or(
139 return config[parent][field].value_or(
int64_t parseTOMLFieldInt(string parent, string field)
Parses an integer field from the TOML configuration.
Definition toml_parser.hpp:137
string_view parseTOMLField(string parent, string field)
Parses a string field from the TOML configuration.
Definition toml_parser.hpp:121
string getCachePath()
Definition toml_parser.hpp:62
auto config
Definition toml_parser.hpp:109
bool configFileExists(const string &filePath)
Checks if the configuration file exists.
Definition toml_parser.hpp:84
auto loadConfig()
Loads the configuration file.
Definition toml_parser.hpp:95
string getConfigPath(string fileName)
Retrieves the path to the configuration file.
Definition toml_parser.hpp:48