Skip to content

Commit 0642aff

Browse files
committed
Check for existence again
1 parent 84f36f1 commit 0642aff

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/stdlib_io_filesystem.F90

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,13 @@ subroutine list_dir(dir, files, iostat, iomsg)
6868

6969
stat = 0
7070

71-
if (is_windows()) then
71+
if (.not. exists(temp_dir)) then
7272
call run('mkdir '//temp_dir, stat)
73-
else
74-
call run('mkdir -p '//temp_dir, stat)
75-
end if
76-
77-
if (stat /= 0) then
78-
if (present(iostat)) iostat = stat
79-
if (present(iomsg)) iomsg = "Failed to create temporary directory '"//temp_dir//"'."
80-
return
73+
if (stat /= 0) then
74+
if (present(iostat)) iostat = stat
75+
if (present(iomsg)) iomsg = "Failed to create temporary directory '"//temp_dir//"'."
76+
return
77+
end if
8178
end if
8279

8380
call run('ls '//dir//' > '//listed_contents, stat)

0 commit comments

Comments
 (0)