mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
config: use fallback when XDG_CONFIG_{HOME,DIRS} is set, but empty
This commit is contained in:
parent
20608c987b
commit
c7dd30742a
1 changed files with 2 additions and 2 deletions
4
config.c
4
config.c
|
|
@ -414,7 +414,7 @@ open_config(void)
|
||||||
char *xdg_config_dirs_copy = NULL;
|
char *xdg_config_dirs_copy = NULL;
|
||||||
|
|
||||||
/* Use XDG_CONFIG_HOME, or ~/.config */
|
/* Use XDG_CONFIG_HOME, or ~/.config */
|
||||||
if (xdg_config_home != NULL) {
|
if (xdg_config_home != NULL && xdg_config_home[0] != '\0') {
|
||||||
int fd = open(xdg_config_home, O_RDONLY);
|
int fd = open(xdg_config_home, O_RDONLY);
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
path_component_add(&components, xdg_config_home, fd);
|
path_component_add(&components, xdg_config_home, fd);
|
||||||
|
|
@ -447,7 +447,7 @@ open_config(void)
|
||||||
/* Finally, try foot/foot.ini in all XDG_CONFIG_DIRS, or /etc/xdg
|
/* Finally, try foot/foot.ini in all XDG_CONFIG_DIRS, or /etc/xdg
|
||||||
* if unset */
|
* if unset */
|
||||||
const char *xdg_config_dirs = getenv("XDG_CONFIG_DIRS");
|
const char *xdg_config_dirs = getenv("XDG_CONFIG_DIRS");
|
||||||
xdg_config_dirs_copy = xdg_config_dirs != NULL
|
xdg_config_dirs_copy = xdg_config_dirs != NULL && xdg_config_dirs[0] != '\0'
|
||||||
? strdup(xdg_config_dirs)
|
? strdup(xdg_config_dirs)
|
||||||
: strdup("/etc/xdg");
|
: strdup("/etc/xdg");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue