Added data files

This commit is contained in:
Keith Bowes 2022-02-22 20:29:04 -05:00
parent 0f612080fa
commit c4e224d5fa
53 changed files with 713 additions and 54 deletions

View file

@ -126,22 +126,24 @@ static bool parse_key_bindings(struct wb_config *config, xmlXPathContextPtr ctxt
bool init_config(struct wb_server *server) {
xmlDocPtr doc;
if (server->config_file == NULL) {
char *rc_file;
if (getenv("WB_RC_XML")) {
rc_file = strdup(getenv("WB_RC_XML"));
} else if (server->config_file != NULL) {
rc_file = strdup(server->config_file);
} else {
char *xdg_config = getenv("XDG_CONFIG_HOME");
if (!xdg_config)
xdg_config = "~/.config";
char *rc_file = malloc(strlen(xdg_config) + 14);
rc_file = malloc(strlen(xdg_config) + 14);
strcpy(rc_file, xdg_config);
rc_file = strcat(rc_file, "/waybox/rc.xml");
doc = xmlParseFile(rc_file);
wlr_log(WLR_INFO, "Using config file %s", rc_file);
free(rc_file);
} else {
wlr_log(WLR_INFO, "Using config file %s", server->config_file);
doc = xmlReadFile(server->config_file, NULL, XML_PARSE_RECOVER);
}
doc = xmlReadFile(rc_file, NULL, XML_PARSE_RECOVER);
wlr_log(WLR_INFO, "Using config file %s", rc_file);
free(rc_file);
if (doc == NULL) {
wlr_log(WLR_ERROR, "%s", _("Unable to parse the configuration file. Consult stderr for more information."));
return false;

View file

@ -23,4 +23,5 @@ executable(
include_directories: [inc_dir],
dependencies: [wb_dep, wlr_protos],
install: true,
install_dir: get_option('prefix') / get_option('libexecdir'),
)