subroutine ESMF_UtilIORmDir (pathName, keywordEnforcer, &
filesFlag, relaxedFlag, rc)
!
! !PARAMETERS:
character(*), intent(in) :: pathName
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
logical, intent(in), optional :: filesFlag
logical, intent(in), optional :: relaxedFlag
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! Call the system-dependent routine to remove a directory from the file
! system. Note that the directory must be empty in order to be successfully
! removed.
!
! The arguments are:
! \begin{description}
! \item[pathName]
! Name of the directory to be removed.
! \item[{[filesFlag]}]
! When set to {\tt .true.}, remove the directory, including any contained
! files. Contained directories are not removed. If not specified,
! the default is {\tt .false.}.
! \item[{[relaxedFlag]}]
! If set to {\tt .true.}, and if the specified directory does not exist,
! the error is ignored and {\tt rc} will be set to {\tt ESMF\_SUCCESS}.
! If not specified, the default is {\tt .false.}.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!EOPI
integer :: localrc
type(ESMF_Logical) :: fflag
type(ESMF_Logical) :: rflag
if (present(rc)) rc = ESMF_FAILURE
fflag = .false.
if (present (filesFlag)) fflag = filesFlag
if (fflag == ESMF_TRUE) then
if (ESMF_LogFoundError (ESMF_RC_NOT_IMPL, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) &
return
end if
rflag = .false.
if (present (relaxedFlag)) rflag = relaxedFlag
call c_esmc_removedirectory (pathname, rflag, localrc)
if (ESMF_LogFoundError (localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) &
return
if (present (rc)) then
rc = localrc
end if
end subroutine ESMF_UtilIORmDir