aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2020-07-12 09:43:09 +0200
committerPatrick Spek <p.spek@tyil.nl>2020-07-12 09:43:09 +0200
commit55833686221d2242d318954e08180bb3c1d87840 (patch)
tree142429937b1f06ce9d3a3f9b295d55a319cca25a
parent102fa5d81bf759ebd42f7c1c0ad4da647ad00203 (diff)
Change XDG file lookup to a glob
-rw-r--r--META6.json3
-rw-r--r--lib/Config.rakumod8
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<cpan:TYIL>:version<0.3.0>"
+ "Log:auth<cpan:TYIL>: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
})
;