Usage
Summary
This library works by resolving a few key directories and saving the results to variables, namely:
- Data,
DATA_HOME
andDATA_DIRS
- Config, with
CONFIG_HOME
andCONFIG_DIRS
- Executables, with
BIN_HOME
- State data, with
STATE_HOME
- Cached data, with
CACHE_HOME
- Runtime data, with
RUNTIME_DIR
While it is possible to use these variables directly, it is recommended that you make use of the accessor functions instead, which all follow this pattern:
accessor() # Give the base directory(ies)
accessor(parts...) # Give the base directory(ies) joined with parts
accessor(proj::Project) # Give the base directory(ies) for proj
acessors(proj::Project, parts...) # proj directory(ies) joined with parts
Where accessor
is a stand-in for the particular named directory being resolved. Two boolean keyword arguments are often supported:
create
, to create the path when it does not exist. This is different to simply piping the returned path intomkpath
in that it: a. Takes care to create the base directory with the appropriate mode (700
) b. Creates the directory component of the path with the default mode (usually755
) c. If the path is to a file (i.e. the path does not end with/
), ~touch~es the file.existent
, to filter the list of provided paths to ones that exist (when applicable)
To give appropriate project-specific directories we can use a BaseDirs.Project
:
Missing docstring for BaseDirs.Project
. Check Documenter's build log for details.
The user and system forms of the various accessor functions are split into the User
and System
modules, with combined accessors in the XDG
namespace. This essentially creates a tree of accessor functions:
- User
data
config
bin
state
cache
runtime
fonts
applications
- System
data
config
fonts
applications
data
config
fonts
applications
The User
submodule also provides a number of other "user folder" accessors, namely:
desktop
downloads
documents
music
pictures
videos
templates
public
Example usage
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"
Variables
Base directories
Missing docstring for BaseDirs.DATA_HOME
. Check Documenter's build log for details.
Missing docstring for BaseDirs.DATA_DIRS
. Check Documenter's build log for details.
Missing docstring for BaseDirs.CONFIG_HOME
. Check Documenter's build log for details.
Missing docstring for BaseDirs.CONFIG_DIRS
. Check Documenter's build log for details.
Missing docstring for BaseDirs.BIN_HOME
. Check Documenter's build log for details.
Missing docstring for BaseDirs.STATE_HOME
. Check Documenter's build log for details.
Missing docstring for BaseDirs.CACHE_HOME
. Check Documenter's build log for details.
Missing docstring for BaseDirs.RUNTIME_DIR
. Check Documenter's build log for details.
User directories
Missing docstring for BaseDirs.DESKTOP_DIR
. Check Documenter's build log for details.
Missing docstring for BaseDirs.DOWNLOAD_DIR
. Check Documenter's build log for details.
Missing docstring for BaseDirs.DOCUMENTS_DIR
. Check Documenter's build log for details.
Missing docstring for BaseDirs.PICTURES_DIR
. Check Documenter's build log for details.
Missing docstring for BaseDirs.VIDEOS_DIR
. Check Documenter's build log for details.
Missing docstring for BaseDirs.TEMPLATES_DIR
. Check Documenter's build log for details.
Missing docstring for BaseDirs.PUBLICSHARE_DIR
. Check Documenter's build log for details.
Other directories
Missing docstring for BaseDirs.APPLICATIONS_DIRS
. Check Documenter's build log for details.
Missing docstring for BaseDirs.FONTS_DIRS
. Check Documenter's build log for details.
Functions
User
Missing docstring for BaseDirs.User
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.data
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.config
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.bin
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.state
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.cache
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.runtime
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.desktop
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.downloads
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.documents
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.music
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.pictures
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.videos
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.templates
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.public
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.fonts
. Check Documenter's build log for details.
Missing docstring for BaseDirs.User.applications
. Check Documenter's build log for details.
System
Missing docstring for BaseDirs.System
. Check Documenter's build log for details.
Missing docstring for BaseDirs.System.data
. Check Documenter's build log for details.
Missing docstring for BaseDirs.System.config
. Check Documenter's build log for details.
Missing docstring for BaseDirs.System.fonts
. Check Documenter's build log for details.
Missing docstring for BaseDirs.System.applications
. Check Documenter's build log for details.
Combined
Missing docstring for BaseDirs.data
. Check Documenter's build log for details.
Missing docstring for BaseDirs.config
. Check Documenter's build log for details.
Missing docstring for BaseDirs.fonts
. Check Documenter's build log for details.
Missing docstring for BaseDirs.applications
. Check Documenter's build log for details.