9namespace fs = std::filesystem;
16#define PARENT_LIB "library"
17#define PARENT_LIB_FIELD_NAME "name"
18#define PARENT_LIB_FIELD_DIR "directory"
20#define PARENT_FTP "ftp"
21#define PARENT_FTP_FIELD_USER "username"
22#define PARENT_FTP_FIELD_SALT "salt"
23#define PARENT_FTP_FIELD_PWD_HASH "password_hash"
25#define PARENT_DBG "debug"
26#define PARENT_DBG_FIELD_TAGLIB_PARSER_LOG \
28#define PARENT_DBG_FIELD_COLORS_PARSER_LOG "colors_parser_log"
29#define PARENT_DBG_FIELD_KEYBINDS_PARSER_LOG "keybinds_parser_log"
32#define PARENT_KEYBINDS "keybinds"
33#define SPECIAL_KEYBIND_ENTER_STR "Enter"
34#define SPECIAL_KEYBIND_TAB_STR "Tab"
35#define SPECIAL_KEYBIND_SPACE_STR "Space"
37#define PARENT_COLORS "colors"
41#define CUSTOM_CONFIG_MACRO "INLIMBO_CONFIG_HOME"
60 return string(customConfigHome);
63 const char* homeDir = getenv(
"HOME");
66 cerr <<
"ERROR: HOME environment variable not found." << endl;
70 return string(homeDir) +
"/.config/inLimbo/";
85 const char* homeDir = std::getenv(
"HOME");
88 cerr <<
"ERROR: HOME environment variable not found." << endl;
92 string cacheFilePath = string(homeDir) +
"/.cache/inLimbo/";
122 cerr <<
"ERROR: config.toml not found in " << configFilePath << endl;
126 cout <<
"-- CONFIG: Loading config.toml file: " << configFilePath << endl;
128 return toml::parse_file(configFilePath);
146 return config[parent][field].value_or(
162 string field) -> string_view
164 return custom_config[parent][field].value_or(
180 return config[parent][field].value_or(
196 string field) -> int64_t
198 return custom_config[parent][field].value_or(
string getBaseConfigPath()
Retrieves the path to the configuration directory.
Definition toml_parser.hpp:55
#define CUSTOM_CONFIG_MACRO
Definition toml_parser.hpp:41
auto parseTOMLFieldInt(string parent, string field) -> int64_t
Parses an integer field from the TOML configuration.
Definition toml_parser.hpp:178
string getCachePath()
Definition toml_parser.hpp:83
auto parseTOMLFieldCustom(const toml::parse_result &custom_config, string parent, string field) -> string_view
Parses a string field from a custom TOML configuration that is called by the INLIMBO_CONFIG_HOME macr...
Definition toml_parser.hpp:161
auto parseTOMLFieldBool(const string &parent, const string &field) -> bool
Definition toml_parser.hpp:202
auto config
Definition toml_parser.hpp:132
auto parseTOMLFieldIntCustom(const toml::parse_result &custom_config, string parent, string field) -> int64_t
Parses an integer field from a custom TOML configuration set by the INLIMBO_CONFIG_HOME macro at runt...
Definition toml_parser.hpp:195
auto parseTOMLField(string parent, string field) -> string_view
Parses a string field from the TOML configuration.
Definition toml_parser.hpp:144
bool configFileExists(const string &filePath)
Checks if the configuration file exists.
Definition toml_parser.hpp:105
auto loadConfig()
Loads the configuration file.
Definition toml_parser.hpp:116
string getConfigPath(string fileName)
Retrieves the full path to the configuration file.
Definition toml_parser.hpp:81