check_dataovr_file Subroutine

private 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.

Arguments

Type IntentOptional Attributes Name
type(dataovr_entry_config_t), intent(in) :: e
character(len=*), intent(in) :: tag
logical, intent(inout) :: has_error

Calls

proc~~check_dataovr_file~~CallsGraph proc~check_dataovr_file check_dataovr_file error error proc~check_dataovr_file->error

Called by

proc~~check_dataovr_file~~CalledByGraph proc~check_dataovr_file check_dataovr_file proc~validate_config validate_config proc~validate_config->proc~check_dataovr_file proc~build_pending_handle build_pending_handle proc~build_pending_handle->proc~validate_config proc~rdb_ocean_create_from_string rdb_ocean_create_from_string proc~rdb_ocean_create_from_string->proc~build_pending_handle proc~rdb_ocean_create_pending rdb_ocean_create_pending proc~rdb_ocean_create_pending->proc~build_pending_handle

Variables

Type Visibility Attributes Name Initial
logical, private :: exists

Source Code

   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