dirname Function

public function dirname(file_path)

Subroutine that keeps only the directory from a file path

Arguments

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

Return Value character(len=:), allocatable


Calls

proc~~dirname~~CallsGraph proc~dirname dirname proc~dir_separator dir_separator proc~dirname->proc~dir_separator proc~is_linux is_linux proc~dir_separator->proc~is_linux

Source Code

   function dirname(file_path)
   !! Subroutine that keeps only the directory from a file path
   implicit none
   character(len = * ), intent(in) :: file_path
   character(len = :), allocatable :: dirname

      character(len = 1) :: sep
      integer(kind = I4) :: ind

      sep = dir_separator()

      ind = index( file_path, sep, back = .true. )

      dirname = trim( file_path( :ind - 1 ) )

   return
   endfunction dirname