diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-09-26 08:13:58 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-09-26 08:49:51 +0200 |
commit | a3ad5e775187ed04184f76e21cfbf44782f85561 (patch) | |
tree | 813e08cc304d6e6c2f636c409a82a2c5f188943d | |
parent | 960420df3e7ba3e399fbc73001d79b5d1cf10a1d (diff) | |
download | liberty-a3ad5e775187ed04184f76e21cfbf44782f85561.tar.gz liberty-a3ad5e775187ed04184f76e21cfbf44782f85561.tar.xz liberty-a3ad5e775187ed04184f76e21cfbf44782f85561.zip |
Ignore empty XDG_*_DIRS env. variables
As the specification says we should. GLib does this as well.
It is still possible to achieve an empty set by using ":",
which are two non-absolute paths that should be ignored.
GLib doesn't implement this. Thus, we're now better than GLib.
-rw-r--r-- | liberty.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -3247,7 +3247,7 @@ get_xdg_config_dirs (struct strv *out) str_free (&config_home); const char *xdg_config_dirs; - if (!(xdg_config_dirs = getenv ("XDG_CONFIG_DIRS"))) + if (!(xdg_config_dirs = getenv ("XDG_CONFIG_DIRS")) || !*xdg_config_dirs) xdg_config_dirs = "/etc/xdg"; cstr_split (xdg_config_dirs, ":", true, out); } @@ -3272,7 +3272,7 @@ get_xdg_data_dirs (struct strv *out) str_free (&data_home); const char *xdg_data_dirs; - if (!(xdg_data_dirs = getenv ("XDG_DATA_DIRS"))) + if (!(xdg_data_dirs = getenv ("XDG_DATA_DIRS")) || !*xdg_data_dirs) xdg_data_dirs = "/usr/local/share/:/usr/share/"; cstr_split (xdg_data_dirs, ":", true, out); } |