subroutinetemporary_directory
subroutine temporary_directory(path)
The directory for temporary files.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| path | character(len=:) | out | allocatable | the directory |
Calls
Source
Show the code
subroutine temporary_directory(path)
character(len=:), allocatable, intent(out) :: path !! the directory
character(len=*), parameter :: NAMES(*) = [character(len=6) :: 'TMPDIR', 'TEMP', 'TMP']
integer :: k, n, status
do k = 1, size(NAMES)
call get_environment_variable(trim(NAMES(k)), length=n, status=status)
if (status /= 0 .or. n == 0) cycle
allocate (character(len=n) :: path)
call get_environment_variable(trim(NAMES(k)), path)
return
end do
path = merge('. ', '/tmp', is_windows())
path = trim(path)
end subroutine temporary_directory