Skip to content

Commit

Permalink
Use dir /b on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
minhqdao committed Sep 20, 2024
1 parent 7e91c7c commit 21739b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stdlib_io_filesystem.F90
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ subroutine list_dir(dir, files, iostat, iomsg)
end if
end if

call run('ls '//dir//' > '//listed_contents, stat)
if (is_windows()) then
call run('dir /b '//dir//' > '//listed_contents, stat)
else
call run('ls '//dir//' > '//listed_contents, stat)
end if
if (stat /= 0) then
if (present(iostat)) iostat = stat
if (present(iomsg)) iomsg = "Failed to list files in directory '"//dir//"'."
Expand Down

0 comments on commit 21739b7

Please sign in to comment.