aboutsummaryrefslogtreecommitdiff
path: root/src/fpm_command_line.f90
diff options
context:
space:
mode:
Diffstat (limited to 'src/fpm_command_line.f90')
-rw-r--r--src/fpm_command_line.f9021
1 files changed, 5 insertions, 16 deletions
diff --git a/src/fpm_command_line.f90 b/src/fpm_command_line.f90
index 095a533..f44bcd0 100644
--- a/src/fpm_command_line.f90
+++ b/src/fpm_command_line.f90
@@ -26,9 +26,7 @@ module fpm_command_line
use fpm_environment, only : get_os_type, get_env, &
OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_WINDOWS, &
OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_OPENBSD
-use fpm_error, only : error_t
use M_CLI2, only : set_args, lget, sget, unnamed, remaining, specified
-use fpm_os, only : change_directory, get_current_directory
use fpm_strings, only : lower, split, fnv_1a
use fpm_filesystem, only : basename, canon_path, to_fortran_name
use fpm_compiler, only : get_default_compile_flags
@@ -48,6 +46,7 @@ public :: fpm_cmd_settings, &
get_command_line_settings
type, abstract :: fpm_cmd_settings
+ character(len=:), allocatable :: working_dir
logical :: verbose=.true.
end type
@@ -121,9 +120,7 @@ contains
integer :: i
integer :: widest
type(fpm_install_settings), allocatable :: install_settings
- character(len=:), allocatable :: pwd_start, working_dir
- character(len=:), allocatable :: common_args
- type(error_t), allocatable :: error
+ character(len=:), allocatable :: common_args, working_dir
call set_help()
! text for --version switch,
@@ -153,8 +150,6 @@ contains
if(adjustl(cmdarg(1:1)) .ne. '-')exit
enddo
- call get_current_directory(pwd_start)
-
common_args = '--directory:C " " '
! now set subcommand-specific help text and process commandline
@@ -473,15 +468,9 @@ contains
end select
- ! Change working directory if requested
- working_dir = sget("directory")
- if (len_trim(working_dir) > 0) then
- call change_directory(working_dir, error)
- if (allocated(error)) then
- write(stderr, '(*(a, 1x))') "<ERROR>", error%message
- stop 1
- end if
- write(stdout, '(*(a))') "fpm: Entering directory '"//working_dir//"'"
+ if (allocated(cmd_settings)) then
+ working_dir = sget("directory")
+ call move_alloc(working_dir, cmd_settings%working_dir)
end if
contains