Eina_Bool ems_config_init(const char *config_file) { directory_edd = ENNA_CONFIG_DD_NEW("Ems_Directory", Ems_Directory); #undef T #undef D #define T Ems_Directory #define D directory_edd ENNA_CONFIG_VAL(D, T, path, EET_T_STRING); ENNA_CONFIG_VAL(D, T, label, EET_T_STRING); ENNA_CONFIG_VAL(D, T, type, EET_T_UINT); conf_edd = ENNA_CONFIG_DD_NEW("config", Ems_Config); #undef T #undef D #define T Ems_Config #define D conf_edd ENNA_CONFIG_VAL(D, T, version, EET_T_UINT); ENNA_CONFIG_VAL(D, T, port, EET_T_SHORT); ENNA_CONFIG_VAL(D, T, port_stream, EET_T_SHORT); ENNA_CONFIG_VAL(D, T, name, EET_T_STRING); ENNA_CONFIG_LIST(D, T, places, directory_edd); ENNA_CONFIG_VAL(D, T, video_extensions, EET_T_STRING); ENNA_CONFIG_VAL(D, T, music_extensions, EET_T_STRING); ENNA_CONFIG_VAL(D, T, photo_extensions, EET_T_STRING); ENNA_CONFIG_VAL(D, T, blacklist, EET_T_STRING); ENNA_CONFIG_VAL(D, T, scan_period, EET_T_UINT); ENNA_CONFIG_VAL(D, T, cache_path, EET_T_STRING); ENNA_CONFIG_VAL(D, T, uuid, EET_T_STRING); _make_config(config_file); ems_config = _config_get(conf_edd); DBG("Config values :\n\tversion: %d\n" "\tport: %d\n" "\tport stream: %d\n" "\tname: %s\n" "\tvideo ext: %s\n" "\tmusic ext: %s\n" "\tphoto ext: %s\n" "\tblacklist: %s\n" "\tscan period : %d\n" "\tcache path : %s\n" "\tuuid : %s\n", ems_config->version, ems_config->port, ems_config->port_stream, ems_config->name, ems_config->video_extensions, ems_config->music_extensions, ems_config->photo_extensions, ems_config->blacklist, ems_config->scan_period, ems_config->cache_path, ems_config->uuid); return EINA_TRUE; }
static const char *get_variable_content(config_t *cfg, const char *variable) { const char *ptr; unsigned int line = 0; /* * Variable sets at runtime. */ ptr = variable_get(variable); if ( ! ptr ) /* * Other variable (declared in the configuration file). */ ptr = _config_get(cfg, NULL, variable, &line); return ptr; }
String user_cache_dir(void) { return _config_get("XDG_CACHE_HOME", "/.cache"); }
String user_data_dir(void) { return _config_get("XDG_DATA_HOME", "/.local/share"); }
String user_config_dir(void) { return _config_get("XDG_CONFIG_HOME", "/.config"); }