fdoc

functionlocateprivate

character(len=:) function locate(search, directory, name) result(path)

The path of include file name, or '' if it is not found.

Arguments

NameTypeIntentAttributesDescription
directorycharacter(len=*)in

the directory of the including file

namecharacter(len=*)in

the file

Result

NameTypeAttributesDescription
pathcharacter(len=:)privateallocatable

Source

Show the code
function locate(search, directory, name) result(path)
    type(string_t), intent(in) :: search(:)     !! other directories to look in
    character(len=*), intent(in) :: directory   !! the directory of the including file
    character(len=*), intent(in) :: name        !! the file
    character(len=:), allocatable :: path
    logical :: exists
    integer :: k

    path = join_path(directory, name)
    inquire (file=path, exist=exists)
    if (exists) return
    do k = 1, size(search)
        path = join_path(search(k)%s, name)
        inquire (file=path, exist=exists)
        if (exists) return
    end do
    path = ''
end function locate

Graphs

Called by