After much indecision regarding the package name, BaseDirs
is finally registered!
See the Pre-ANN/RFC thread for a recap on what the package is, but the TLDR; is it provides a cross-platform way of finding the appropriate place to look for/put files, because .julia
is not a panacea.
This is a very small and lightweight package (with zero dependencies), using Julia 1.9-rc1 it takes ~25ms to load on my machine.
If you work on a package that asks any questions like “where should I put some cache files?”, “where can I find system fonts?”, “what’s a good place to save a document?” or similar, I’d recommend giving this package a look.
For more info, see the (somewhat detailed) docs: https://tecosaur.github.io/BaseDirs.jl
To finish off, here’s some example usage of the package:
julia> using BaseDirs
julia> BaseDirs.CONFIG_HOME[]
"/home/tec/.config"
julia> BaseDirs.User.config()
"/home/tec/.config"
julia> BaseDirs.User.config("sub", "dir/")
"/home/tec/.config/sub/dir/"
julia> BaseDirs.User.config(BaseDirs.Project("mything"), "config.conf", create=true)
"/home/tec/.config/mything/config.conf"