aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-05-25 07:49:38 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-05-25 07:49:38 -0400
commit4a2f81c205df8e6e2a90f41e19c552d35cf54ce1 (patch)
treeab4dbf8eb369c13995d00a68b512a7c534721c86
parent9cfaf50daf1497511315cd5c40ac2b4ed8a54bd1 (diff)
downloadlevitating-4a2f81c205df8e6e2a90f41e19c552d35cf54ce1.tar.gz
levitating-4a2f81c205df8e6e2a90f41e19c552d35cf54ce1.zip
Added directory to filename for upload when mask is specified.
-rw-r--r--common/utilities.F9020
-rw-r--r--player/tasks.f9010
2 files changed, 29 insertions, 1 deletions
diff --git a/common/utilities.F90 b/common/utilities.F90
index dbd0423..61c5d93 100644
--- a/common/utilities.F90
+++ b/common/utilities.F90
@@ -98,6 +98,26 @@ contains
end subroutine combine_paths
+ subroutine path_from_file(file, path)
+ implicit none
+
+ character(*), intent(in)::file
+ character(*), intent(out)::path
+ integer::i
+
+ i = index(file, '/', back=.true.)
+ if(i <= 0) then
+ i = index(file, '\', back=.true.)
+ end if
+
+ if(i <= 0) then
+ path = '.'
+ else
+ path = file(1:i)
+ end if
+
+ end subroutine path_from_file
+
subroutine write_date_and_time(unit_number, values)
implicit none
diff --git a/player/tasks.f90 b/player/tasks.f90
index 278a0d0..b0c881e 100644
--- a/player/tasks.f90
+++ b/player/tasks.f90
@@ -102,6 +102,7 @@ contains
character(DIR_LIST_STRING_LENGTH), dimension(:), pointer::files
logical, dimension(:), allocatable::statuses
integer::i
+ character(len=:), allocatable::dir, fullname
! We can cheat by using the get_files_in_directory function since it
! is merely calling ls/dir, which will resolve the glob
@@ -113,15 +114,22 @@ contains
if(associated(files)) then
+ allocate(character(len=len_trim(mask)) :: dir)
+ allocate(character(len=len_trim(mask)+DIR_LIST_STRING_LENGTH+1) :: fullname)
+ call path_from_file(mask, dir)
+
allocate(statuses(size(files)))
do i = 1, size(files)
- statuses(i) = upload(url, files(i))
+ call combine_paths(dir, files(i), fullname)
+ statuses(i) = upload(url, fullname)
end do
res = all(statuses)
deallocate(statuses)
deallocate(files)
+ deallocate(dir)
+ deallocate(fullname)
else