#+title: Defaults

From our [[file:../others][survey of other simlar packages]], we've seen a range of approaches.
Trying to take the best of those, these are the defaults that BaseDirs.jl uses.

* Base directories

| Common Name      | EnvVar                    | Linux                        | MacOS                                            | Windows (KnownPath)                                 |
|------------------+---------------------------+------------------------------+--------------------------------------------------+-----------------------------------------------------|
| User data        | =XDG_DATA_HOME=             | =~/.local/share=               | =~/Library/Application Support=                    | =RoamingAppData=                                      |
| System data      | =XDG_DATA_DIRS=             | =/usr/local/share=, =/usr/share= | =/Library/Application Support=                     | =ProgramData=                                         |
| User config      | =XDG_CONFIG_HOME=           | =~/.config=                    | =~/Library/Application Support=                    | =RoamingAppData=                                      |
| System config    | =XDG_CONFIG_DIRS=           | =/etc/xdg=                     | =/Library/Application Support=                     | =ProgramData=                                         |
| State            | =XDG_STATE_HOME=            | =~/.local/state=               | =~/Library/Application Support=                    | =LocalAppData=                                        |
| User executables | =XDG_BIN_HOME= [fn:binhome] | =~/.local/bin=                 | =~/.local/bin= or =/opt/local/bin= or =/usr/local/bin= | =~\bin= or =RoamingAppData\bin= or =AppData\bin= or ~pwd()~ |
| Cache            | =XDG_CACHE_HOME=            | =~/.cache=                     | =~/Library/Caches/=                                | =LocalAppData\cache=                                  |
| Runtime          | =XDG_RUNTIME_DIR=           | =/run/user/$UID=               | =~/Library/Application Support=                    | =LocalAppData=                                        |

[fn:binhome] While =XDG_BIN_HOME= is not yet standard, it seems like the most
likely name to be given to =~/.local/bin= (see [[https://gitlab.freedesktop.org/xdg/xdg-specs/-/issues/14][this issue]]), and I think it is
worth having something rather than nothing.

* User directories

| Common Name | EnvVar              | Linux[fn:xdg-user-dirs] | MacOS       | Windows (KnownPath)    |
|-------------+---------------------+-------------------------+-------------+------------------------|
| Desktop     | =XDG_DESKTOP_DIR=     | =~/Desktop=               | =~/Desktop=   | =Desktop=                |
| Download    | =XDG_DOWNLOAD_DIR=    | =~/Downloads=             | =~/Downloads= | =Downloads=              |
| Documents   | =XDG_DOCUMENTS_DIR=   | =~/Documents=             | =~/Documents= | =Documents=              |
| Projects    | =XDG_PROJECTS_DIR=    | =~/Projects=              | =~/Projects=  | =~\Projects=[fn:winproj] |
| Music       | =XDG_MUSIC_DIR=       | =~/Music=                 | =~/Music=     | =Music=                  |
| Pictures    | =XDG_PICTURES_DIR=    | =~/Pictures=              | =~/Pictures=  | =Pictures=               |
| Videos      | =XDG_VIDEOS_DIR=      | =~/Videos=                | =~/Movies=    | =Videos=                 |
| Templates   | =XDG_TEMPLATES_DIR=   | =~/Templates=             | =~/Templates= | =Templates=              |
| Public      | =XDG_PUBLICSHARE_DIR= | =~/Public=                | =~/Public=    | =Public=                 |

[fn:xdg-user-dirs] In accordance with the [[https://www.freedesktop.org/wiki/Software/xdg-user-dirs/][xdg-user-dirs]] documentation, the
system and user =user-dirs.dirs= files are checked before using the defaults.

[fn:winproj] Since there is no known projects directory on windows, we use the
=Projects= subdirectory of =FOLDERID_Profile=.

* Application directories

** Application paths

An application path string (henceforth given by the =App= placeholder) is formatted
according to the following bits of information:
+ Qualifier (only used on mac), which defaults to =org=
+ Organisation/Company, which defaults to =julia=
+ Application name, which must be provided.

The operating system specific application path is composed as follows:

| System  | Application path format        | Example              |
|---------+--------------------------------+----------------------|
| Linux   | =$Name=                          | =contraption=          |
| MacOS   | =$Qualifier.$Organisation.$Name= | =com.ACME.contraption= |
| Windows | =$Organisation\$Name=            | =ACME\contraption=     |
  
** Application directory template

| Common Name   | Linux                 | MacOS                 | Windows                      |
|---------------+-----------------------+-----------------------+------------------------------|
| User data     | =$(User data)/$App=   | =$(User data)/$App=   | =$(User data)\$App\data=       |
| System data   | =$(System data)/$App=   | =$(System data)/$App=   | =$(System data)\$App\data=     |
| User config   | =$(User config)/$App=   | =$(User config)/$App=   | =$(User config)\$App\config=   |
| System config | =$(System config)/$App= | =$(System config)/$App= | =$(System config)\$App\config= |
| Cache         | =$(Cache)/$App=         | =$(Cache)/$App=         | =$(Cache)\$App\cache=          |
| State         | =$(State)/$App=         | =$(State)/$App=         | =$(State)\$App\state=          |

* Extra directories

| Common name  | Linux                                                  | MacOS                                                                          | Windows                  |
|--------------+--------------------------------------------------------+--------------------------------------------------------------------------------+--------------------------|
| Fonts        | =$(User data)/fonts=, =~/.fonts=, =$(System data)/fonts=     | =~/Library/Fonts=, =/Library/Fonts=, =/System/Library/Fonts=, =/Network/Library/Fonts= | =Fonts=                    |
| Applications | =$(User data)/applications=, =$(System data)/applications= | =/Applications=                                                                  | =Programs=, =CommonPrograms= |
