Skip to content

Commit ebf7aca

Browse files
committed
Merge branch 'delete_file' of https://github.com/perazz/stdlib into delete_file
2 parents 3c2f866 + 283ae75 commit ebf7aca

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/stdlib_io_filesystem.F90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ logical function is_directory(path)
5656
! Windows API interface
5757
integer(c_int) :: attrs
5858
integer(c_int), parameter :: FILE_ATTRIBUTE_DIRECTORY = int(z'10',c_int)
59+
5960
interface
6061
! Declare the GetFileAttributesA function from kernel32.dll
6162
integer(c_int) function GetFileAttributesA(lpFileName) bind(c, name="GetFileAttributesA")

test/io/test_filesystem.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ subroutine test_delete_file_existing(error)
6363
call delete_file(filename, state)
6464

6565
! Check deletion successful
66-
call check(error, state%ok(), state%print())
66+
call check(error, state%ok(), 'delete_file returned '//state%print())
6767
if (allocated(error)) return
6868

6969
! Check if the file was successfully deleted (should no longer exist)
@@ -85,18 +85,21 @@ subroutine test_delete_directory(error)
8585
filename = 'test_directory'
8686

8787
! The directory is not nested: it should be cross-platform to just call `mkdir`
88+
print *, 'mkdir'
8889
call execute_command_line('mkdir ' // filename, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
8990
call check(error, ios==0 .and. iocmd==0, 'Cannot init delete_directory test: '//trim(msg))
9091
if (allocated(error)) return
9192

9293
! Attempt to delete a directory (which should fail)
94+
print *, 'dfelete'
9395
call delete_file(filename, state)
9496

9597
! Check that an error was raised since the target is a directory
9698
call check(error, state%error(), 'Error was not triggered trying to delete directory')
9799
if (allocated(error)) return
98100

99101
! Clean up: remove the empty directory
102+
print *, 'rmdir'
100103
call execute_command_line('rmdir ' // filename, exitstat=ios, cmdstat=iocmd, cmdmsg=msg)
101104
call check(error, ios==0 .and. iocmd==0, 'Cannot cleanup delete_directory test: '//trim(msg))
102105
if (allocated(error)) return

0 commit comments

Comments
 (0)