From 76f87ebbf1e763426d6eae2e57dc27fb78767d03 Mon Sep 17 00:00:00 2001 From: "John S. Urban" Date: Fri, 12 Nov 2021 16:45:06 -0500 Subject: correct basename(3f) function and subsequently fix --list option The --list option was incorrectly trimming pathnames when suffix=.false. was present, and the meaning of the --list option has changed from originally being an option to display the full pathnames of targets to displaying a table of matching target basenames. Since the --runner command can be used to display the full pathnames and the runner command defaults to an "echo" command the pathnames can still easily be generated, but an example was added to reflect that. As the help text needed editing anyway, changed some whitespace to conform to the requirements of the txt2man(1) utility, to facilitate easily generating man-pages and HTML versions of the help text. --- src/fpm_filesystem.F90 | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/fpm_filesystem.F90') diff --git a/src/fpm_filesystem.F90 b/src/fpm_filesystem.F90 index 102d6c5..83cffe7 100644 --- a/src/fpm_filesystem.F90 +++ b/src/fpm_filesystem.F90 @@ -94,21 +94,18 @@ function basename(path,suffix) result (base) with_suffix = suffix end if - if (with_suffix) then - call split(path,file_parts,delimiters='\/') - if(size(file_parts).gt.0)then - base = trim(file_parts(size(file_parts))) - else - base = '' - endif + call split(path,file_parts,delimiters='\/') + if(size(file_parts).gt.0)then + base = trim(file_parts(size(file_parts))) else - call split(path,file_parts,delimiters='\/.') + base = '' + endif + if(.not.with_suffix)then + call split(base,file_parts,delimiters='.') if(size(file_parts).ge.2)then base = trim(file_parts(size(file_parts)-1)) - else - base = '' endif - end if + endif end function basename -- cgit v1.2.3