Skip to content

Commit 21739b7

Browse files
committed
Use dir /b on Windows
1 parent 7e91c7c commit 21739b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/stdlib_io_filesystem.F90

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ subroutine list_dir(dir, files, iostat, iomsg)
7777
end if
7878
end if
7979

80-
call run('ls '//dir//' > '//listed_contents, stat)
80+
if (is_windows()) then
81+
call run('dir /b '//dir//' > '//listed_contents, stat)
82+
else
83+
call run('ls '//dir//' > '//listed_contents, stat)
84+
end if
8185
if (stat /= 0) then
8286
if (present(iostat)) iostat = stat
8387
if (present(iomsg)) iomsg = "Failed to list files in directory '"//dir//"'."

0 commit comments

Comments
 (0)