Is there a function that returns the list of directories to look for configuration files in? For example, my home directory is /home/phma/
, so it should return ["/etc/","/home/phma/.local/etc/"]
or something like that.
Have you tried readdir
/walkdir
?
You can use filter
/filter!
in conjunction with endswith
/contains
if config files identifiable by some string patterns…
I know about readdir
, but that’s the answer to not the question I asked. The part of the name of the configuration file after etc/
is known, but which directories to look for configuration files in depends on where the program is installed (or if it’s not installed, i.e. I’m running it from the source directory) and the operating system (in DragonFly, if a program is installed in /usr/local/bin/
, it should look in /usr/local/etc/
).
There’s BaseDirs.jl with Usage · BaseDirs.jl , but it’s not anywhere near as sophisticated as you want it to be - BaseDirs is basically an implementation of the common XDG spec, whereas you want something that knows about the intricacies of different (non-portable) directory conventions and returns the appropriate one for the current system.
BaseDirs.config()
returns /etc/xdg
etc., which as far as I can figure out is for desktop applications, which what I’m writing is not. I think I’ll write my own module, using the user’s home directory and others.