User cache shared across working directories; an explicit configuration path takes precedence.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| logical, | intent(in), | optional | :: | missing_ok |
function default_periodic_cache_directory(missing_ok) result(path) logical, intent(in), optional :: missing_ok character(len=:), allocatable :: path, base integer :: length, status call get_environment_variable('BEACH_CACHE_DIR', length=length, status=status) if (status == 0 .and. length > 0) then allocate (character(len=length) :: base) call get_environment_variable('BEACH_CACHE_DIR', base) path = base//'/periodic2' return end if call get_environment_variable('XDG_CACHE_HOME', length=length, status=status) if (status == 0 .and. length > 0) then allocate (character(len=length) :: base) call get_environment_variable('XDG_CACHE_HOME', base) path = base//'/beach/periodic2' return end if call get_environment_variable('HOME', length=length, status=status) if (status /= 0 .or. length == 0) then ! Defaults are formed before TOML is read; an explicit path must still work without these variables. if (present(missing_ok)) then if (missing_ok) then path = '' return end if end if error stop 'Default BEACH cache requires HOME, XDG_CACHE_HOME or BEACH_CACHE_DIR.' end if allocate (character(len=length) :: base) call get_environment_variable('HOME', base) path = base//'/.cache/beach/periodic2' end function default_periodic_cache_directory