public pure function nml_dirname(path) result(dir)
Directory part of path with a trailing ‘/’, or ‘’ if none.
Arguments
| Type |
Intent | Optional | Attributes |
|
Name |
|
|
character(len=*),
|
intent(in) |
|
|
:: |
path |
|
Return Value
character(len=:), allocatable
Variables
| Type |
Visibility | Attributes |
|
Name |
| Initial | |
|
integer,
|
private |
|
:: |
i |
|
|
|
Source Code
pure function nml_dirname(path) result(dir)
!! Directory part of `path` with a trailing '/', or '' if none.
character(len=*), intent(in) :: path
character(len=:), allocatable :: dir
integer :: i
dir = ""
do i = len_trim(path), 1, -1
if (path(i:i) == "/") then
dir = path(1:i)
return
end if
end do
end function nml_dirname