diff options
author | Laurence Kedward <laurence.kedward@bristol.ac.uk> | 2021-06-05 13:44:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-05 13:44:15 +0100 |
commit | 6fc695ffb7549444b36353c920aeb4f6820b14b8 (patch) | |
tree | cb17a4e6179cc59690a5404fed74e7491bbe4e59 /src/fpm_filesystem.f90 | |
parent | 831ab078d07b2881c5d7fb4318185f3a06192722 (diff) | |
parent | 845217f13a23de91021ba393ef432d68683af282 (diff) | |
download | fpm-6fc695ffb7549444b36353c920aeb4f6820b14b8.tar.gz fpm-6fc695ffb7549444b36353c920aeb4f6820b14b8.zip |
Merge branch 'master' into master
Diffstat (limited to 'src/fpm_filesystem.f90')
-rw-r--r-- | src/fpm_filesystem.f90 | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/fpm_filesystem.f90 b/src/fpm_filesystem.f90 index 87c8a88..486e989 100644 --- a/src/fpm_filesystem.f90 +++ b/src/fpm_filesystem.f90 @@ -11,7 +11,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 public :: which integer, parameter :: LINE_BUFFER_LEN = 1000 @@ -187,6 +187,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) |