Skip to content

Commit 84f36f1

Browse files
committed
Use Windows-specific commands and fix tests
1 parent c1830df commit 84f36f1

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/stdlib_io_filesystem.F90

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

6969
stat = 0
7070

71-
if (.not. exists(temp_dir)) then
71+
if (is_windows()) then
7272
call run('mkdir '//temp_dir, stat)
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
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
7881
end if
7982

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

test/io/test_filesystem.f90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ subroutine fs_list_dir_one_file_one_dir(error)
221221
call test_failed(error, "Creating file 1 in directory '"//temp_list_dir//"' failed."); return
222222
end if
223223

224-
call run('mkdir '//temp_list_dir//'/'//dir, iostat=stat)
224+
if (is_windows()) then
225+
call run('mkdir '//temp_list_dir//'\'//dir, iostat=stat)
226+
else
227+
call run('mkdir '//temp_list_dir//'/'//dir, iostat=stat)
228+
end if
225229
if (stat /= 0) then
226230
call test_failed(error, "Creating dir in directory '"//temp_list_dir//"' failed."); return
227231
end if

0 commit comments

Comments
 (0)