@@ -3,7 +3,7 @@ module stdlib_system
33 c_f_pointer
44use stdlib_kinds, only: int64, dp, c_bool, c_char
55use stdlib_strings, only: to_c_char
6- use stdlib_error, only: state_type, STDLIB_FS_ERROR
6+ use stdlib_error, only: state_type, STDLIB_SUCCESS, STDLIB_FS_ERROR
77implicit none
88private
99public :: sleep
@@ -110,9 +110,10 @@ module stdlib_system
110110! !
111111! !### Description
112112! !
113- ! ! This subroutine deletes a specified file. If the file does not exist, or if it is a directory or inaccessible,
114- ! ! an error is raised. Errors are handled using the library's `state_type` mechanism. If the optional `err` argument
115- ! ! is not provided, exceptions trigger an `error stop`.
113+ ! ! This subroutine deletes a specified file. If the file is a directory or inaccessible, an error is raised.
114+ ! ! If the file does not exist, a warning is returned, but no error state. Errors are handled using the
115+ ! ! library's `state_type` mechanism. If the optional `err` argument is not provided, exceptions trigger
116+ ! ! an `error stop`.
116117! !
117118public :: delete_file
118119
@@ -738,8 +739,8 @@ subroutine delete_file(path, err)
738739 ! Check if the path exists
739740 inquire (file= path, exist= file_exists)
740741 if (.not. file_exists) then
741- ! File does not exist, return error status
742- err0 = state_type(STDLIB_FS_ERROR, ' Cannot delete ' , path,' : file does not exist' )
742+ ! File does not exist, return non- error status
743+ err0 = state_type(STDLIB_SUCCESS, path,' not deleted : file does not exist' )
743744 call err0% handle(err)
744745 return
745746 endif
0 commit comments