mirror of
https://github.com/wizbright/waybox.git
synced 2025-11-25 06:59:48 -05:00
Added data files
This commit is contained in:
parent
0f612080fa
commit
c4e224d5fa
53 changed files with 713 additions and 54 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -23,4 +23,5 @@ executable(
|
|||
include_directories: [inc_dir],
|
||||
dependencies: [wb_dep, wlr_protos],
|
||||
install: true,
|
||||
install_dir: get_option('prefix') / get_option('libexecdir'),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue