EroticDevelopment / GuideMe

An interactive story viewer
MIT License
9 stars 4 forks source link

Add wildcard support to XML Include nodes #28

Open EroticDevelopment opened 3 years ago

EroticDevelopment commented 3 years ago

Allow XML include nodes to use a wildcard or glob syntax to import multiple files at once.

hiss-remi commented 2 years ago

As far as I can tell, this already partially works; the include tag will handle patterns that end with .js and .xml appropriately.

I don't know how much demand there is for other patterns, but I imagine it'd work just fine to replace

if (incFileName.toLowerCase().endsWith("*.js"))

with something like

if (incFileName.toLowerCase().endsWith(".js") && incFileName.contains("*"))

and go from there.

Although that wouldn't actually handle all the things that the glob patterns used by newDirectoryStream can support... Rather than do any more complicated testing, we could just feed incFileName into that handling without checking it at all, and then handle by extension for whatever it spits out. Anything that doesn't contain any special patterns will just give a single-entry list, which is no problem.