From 55833686221d2242d318954e08180bb3c1d87840 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 12 Jul 2020 09:43:09 +0200 Subject: Change XDG file lookup to a glob --- META6.json | 3 ++- lib/Config.rakumod | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/META6.json b/META6.json index e093c3a..f07e385 100644 --- a/META6.json +++ b/META6.json @@ -7,7 +7,8 @@ "depends": [ "Hash::Merge:version<1.0.1>", "IO::Path::XDG:version<0.2.0>", - "Log:auth:version<0.3.0>" + "Log:auth:version<0.3.0>", + "IO::Glob" ], "description": "Extensible library for reading and writing configuration files.", "license": "LGPL-3.0-only", diff --git a/lib/Config.rakumod b/lib/Config.rakumod index db05d7d..57cc671 100644 --- a/lib/Config.rakumod +++ b/lib/Config.rakumod @@ -3,6 +3,7 @@ use v6.d; use Hash::Merge; +use IO::Glob; use IO::Path::XDG; use Log; @@ -430,9 +431,10 @@ method !read-from-xdg-files ( my @files = xdg-config-dirs() .reverse .map(sub ($dir) { - (« $name "$name/config" » X~ < .json .toml .yaml >).map({ - $dir.add($_) - }).Slip + ( + glob("$dir/$name.*").dir('/').map(*.IO).Slip, + glob("$dir/$name/config.*").dir('/').map(*.IO).Slip; + ).Slip }) ; -- cgit v1.1