From 36d0b83bd6a466fb3c233466c42da85b9bb3c0f7 Mon Sep 17 00:00:00 2001 From: zoziha Date: Wed, 31 Aug 2022 00:20:08 +0800 Subject: [PATCH] Minor fix for `fpm new` --- app/main.f90 | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/app/main.f90 b/app/main.f90 index 21cd1b90e3..c7091267fb 100644 --- a/app/main.f90 +++ b/app/main.f90 @@ -46,20 +46,24 @@ program main pwd_working = pwd_start end if -if (.not.has_manifest(pwd_working)) then - project_root = pwd_working - do while(.not.has_manifest(project_root)) - working_dir = parent_dir(project_root) - if (len(working_dir) == 0) exit - project_root = working_dir - end do - - if (has_manifest(project_root)) then - call change_directory(project_root, error) - call handle_error(error) - write(output_unit, '(*(a))') "fpm: Entering directory '"//project_root//"'" +select type (settings => cmd_settings) +type is (fpm_new_settings) +class default + if (.not.has_manifest(pwd_working)) then + project_root = pwd_working + do while(.not.has_manifest(project_root)) + working_dir = parent_dir(project_root) + if (len(working_dir) == 0) exit + project_root = working_dir + end do + + if (has_manifest(project_root)) then + call change_directory(project_root, error) + call handle_error(error) + write(output_unit, '(*(a))') "fpm: Entering directory '"//project_root//"'" + end if end if -end if +end select select type(settings=>cmd_settings) type is (fpm_new_settings)