join Function

function join(a1, a2) result(path)

Construct path by joining strings with os file separator

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: a1
character(len=*), intent(in) :: a2

Return Value character(len=:), allocatable


Source Code

function join(a1, a2) result(path)
   use mctc_env_system, only : is_windows
   character(len=*), intent(in) :: a1, a2
   character(len=:), allocatable :: path
   character :: filesep

   if (is_windows()) then
      filesep = '\'
   else
      filesep = '/'
   end if

   path = a1 // filesep // a2
end function join