Existence check for one tag’s file. NOT pure — inquire is
an I/O statement, which is exactly why this is a subroutine
setting has_error rather than another predicate: the pure
ones above stay pure and independently testable, and this
keeps the filesystem dependency in one visible place.
Silent for a tag that names no file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(dataovr_entry_config_t), | intent(in) | :: | e | |||
| character(len=*), | intent(in) | :: | tag | |||
| logical, | intent(inout) | :: | has_error |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | private | :: | exists |
subroutine check_dataovr_file(e, tag, has_error) !! Existence check for one tag's file. NOT `pure` — `inquire` is !! an I/O statement, which is exactly why this is a subroutine !! setting `has_error` rather than another predicate: the pure !! ones above stay pure and independently testable, and this !! keeps the filesystem dependency in one visible place. !! Silent for a tag that names no file. type(dataovr_entry_config_t), intent(in) :: e character(len=*), intent(in) :: tag logical, intent(inout) :: has_error logical :: exists if (len_trim(e%file) == 0) return inquire (file=trim(e%file), exist=exists) if (.not. exists) then call logger%error("&ocean_dataovr_nml "//tag//"_file not found: '"// & trim(e%file)//"'") has_error = .true. end if end subroutine check_dataovr_file