Deletes a file. Auxiliary routine to emulate 'replace' action for mp_file_open. Only the master processor should call this routine.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filepath |
path to the file |
||
type(mp_info_type), | intent(in), | optional | :: | info |
info object |
SUBROUTINE mp_file_delete(filepath, info) !! Deletes a file. Auxiliary routine to emulate 'replace' action for mp_file_open. !! Only the master processor should call this routine. CHARACTER(LEN=*), INTENT(IN) :: filepath !! path to the file TYPE(mp_info_type), INTENT(IN), OPTIONAL :: info !! info object #if defined(__parallel) INTEGER :: ierr MPI_INFO_TYPE :: my_info LOGICAL :: exists #endif #if defined(__parallel) ierr = 0 my_info = mpi_info_null IF (PRESENT(info)) my_info = info%handle INQUIRE (FILE=filepath, EXIST=exists) IF (exists) CALL mpi_file_delete(filepath, my_info, ierr) IF (ierr .NE. 0) CALL mp_stop(ierr, "mpi_file_set_errhandler @ mp_file_delete") #else MARK_USED(filepath) MARK_USED(info) ! Explicit file delete not necessary, handled by subsequent call to open_file with action 'replace' #endif END SUBROUTINE mp_file_delete