From 5855337167b53abcaa17452ea1c3c048acb34e09 Mon Sep 17 00:00:00 2001 From: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com> Date: Thu, 27 May 2021 21:40:35 +0200 Subject: Automatically search for package manifest --- src/fpm_filesystem.f90 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/fpm_filesystem.f90') diff --git a/src/fpm_filesystem.f90 b/src/fpm_filesystem.f90 index 28c3b33..c9c97dd 100644 --- a/src/fpm_filesystem.f90 +++ b/src/fpm_filesystem.f90 @@ -10,7 +10,7 @@ use,intrinsic :: iso_fortran_env, only : stdin=>input_unit, stdout=>output_unit, private public :: basename, canon_path, dirname, is_dir, join_path, number_of_rows, read_lines, list_files, env_variable, & mkdir, exists, get_temp_filename, windows_path, unix_path, getline, delete_file, to_fortran_name - public :: fileopen, fileclose, filewrite, warnwrite + public :: fileopen, fileclose, filewrite, warnwrite, parent_dir integer, parameter :: LINE_BUFFER_LEN = 1000 @@ -184,6 +184,15 @@ function dirname(path) result (dir) end function dirname +!> Extract dirname from path +function parent_dir(path) result (dir) + character(*), intent(in) :: path + character(:), allocatable :: dir + + dir = path(1:scan(path,'/\',back=.true.)-1) + +end function parent_dir + !> test if a name matches an existing directory path logical function is_dir(dir) -- cgit v1.2.3