From 13a08c508005b9c3b280c05459e943a268b5ccc5 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 6 May 2021 11:47:53 -0400 Subject: Fixed static file handler to allow subdirectories properly. Fixed directory file listing under Linux. Release listing now works through CGI. --- common/utilities.F90 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/utilities.F90 b/common/utilities.F90 index 670d48f..e8bceff 100644 --- a/common/utilities.F90 +++ b/common/utilities.F90 @@ -391,6 +391,7 @@ contains end function get_directories_in_directory function get_files_in_directory(directory) result(res) + use logging implicit none character(*), intent(in)::directory @@ -398,6 +399,7 @@ contains character(80)::line character(len=:), pointer::tempfile + logical::skip_first logical, dimension(:), allocatable::is_real_file integer::unum, ierr, i, n, j @@ -428,6 +430,8 @@ contains i = i + 1 if(len_trim(line) > 0 .and. line(1:1) == '-' .and. line(1:6) /= "total ") then is_real_file(i) = .TRUE. + else if(line(1:6) == "total ") then + skip_first = .TRUE. end if read(unum, '(A)', iostat=ierr) line end do @@ -448,7 +452,12 @@ contains ! Now we can read files i = 0 - j = 0 + if(skip_first) then + j = 1 + else + j = 0 + end if + read(unum, '(A)', iostat=ierr) line do while(ierr == 0 .and. i < n) j = j + 1 -- cgit v1.2.3