diff options
author | init current directory[i] <urbanjost@comcast.net> | 2020-10-11 03:58:43 -0400 |
---|---|---|
committer | init current directory[i] <urbanjost@comcast.net> | 2020-10-11 03:58:43 -0400 |
commit | ad653051402d93544efda095a39372fd922e83b2 (patch) | |
tree | f1ea57cda2dcd6843e0250c3dd023a6a042ac07c | |
parent | ffc515af907f7c090f035d5f2d251c6fb88f74c4 (diff) | |
download | fpm-ad653051402d93544efda095a39372fd922e83b2.tar.gz fpm-ad653051402d93544efda095a39372fd922e83b2.zip |
what is cwd?
-rw-r--r-- | fpm/src/fpm/cmd/new.f90 | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fpm/src/fpm/cmd/new.f90 b/fpm/src/fpm/cmd/new.f90 index 0293033..a8a8876 100644 --- a/fpm/src/fpm/cmd/new.f90 +++ b/fpm/src/fpm/cmd/new.f90 @@ -23,7 +23,9 @@ character(len=:),allocatable :: littlefile(:) else call mkdir(settings%name) ! make new directory endif + call showcwd('before test') call run('cd '//settings%name) ! change to new directory as a test. System dependent potentially + call showcwd('after test') !! NOTE: need some system routines to handle filenames like "." like realpath() or getcwd(). bname=basename(settings%name) @@ -116,9 +118,27 @@ character(len=:),allocatable :: littlefile(:) endif call warnwrite(join_path(settings%name, 'fpm.toml'), message) ! now that built it write NAME/fpm.toml + call showcwd('before init') call run('cd ' // settings%name // ';git init') ! assumes these commands work on all systems and git(1) is installed + call showcwd('after init') contains +subroutine showcwd(msg) +use fpm_environment, only : run, get_os_type +use fpm_environment, only : OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_CYGWIN, OS_SOLARIS, OS_FREEBSD, OS_WINDOWS +character(len=*),intent(in) :: msg + write(*,'(a,1x)',advance='no')msg + select case (get_os_type()) + case (OS_UNKNOWN, OS_LINUX, OS_MACOS, OS_CYGWIN, OS_SOLARIS, OS_FREEBSD) + call run('pwd') + case (OS_WINDOWS) + call run('chdir') + case default + write(*,*)'ERROR: unknown OS. Stopping test' + stop 2 + end select +end subroutine showcwd + subroutine warnwrite(fname,data) character(len=*),intent(in) :: fname character(len=*),intent(in) :: data(:) |