Ignore empty XDG_CONFIG_DIRS
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.
This commit is contained in:
parent
4ef7c9edf7
commit
8a6bb54eb5
2
sdn.cpp
2
sdn.cpp
|
@ -268,7 +268,7 @@ fun xdg_config_home () -> string {
|
||||||
fun xdg_config_find (const string &suffix) -> unique_ptr<ifstream> {
|
fun xdg_config_find (const string &suffix) -> unique_ptr<ifstream> {
|
||||||
vector<string> dirs {xdg_config_home ()};
|
vector<string> dirs {xdg_config_home ()};
|
||||||
const char *system_dirs = getenv ("XDG_CONFIG_DIRS");
|
const char *system_dirs = getenv ("XDG_CONFIG_DIRS");
|
||||||
split (system_dirs ? system_dirs : "/etc/xdg", ":", dirs);
|
split ((system_dirs && *system_dirs) ? system_dirs : "/etc/xdg", ":", dirs);
|
||||||
for (const auto &dir : dirs) {
|
for (const auto &dir : dirs) {
|
||||||
if (dir[0] != '/')
|
if (dir[0] != '/')
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue