@@ -3,7 +3,7 @@ module stdlib_system
3
3
c_f_pointer
4
4
use stdlib_kinds, only: int64, dp, c_bool, c_char
5
5
use 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
7
7
implicit none
8
8
private
9
9
public :: sleep
@@ -110,9 +110,10 @@ module stdlib_system
110
110
! !
111
111
! !### Description
112
112
! !
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`.
116
117
! !
117
118
public :: delete_file
118
119
@@ -738,8 +739,8 @@ subroutine delete_file(path, err)
738
739
! Check if the path exists
739
740
inquire (file= path, exist= file_exists)
740
741
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' )
743
744
call err0% handle(err)
744
745
return
745
746
endif
0 commit comments