diff options
author | LKedward <laurence.kedward@bristol.ac.uk> | 2020-09-07 10:10:02 +0100 |
---|---|---|
committer | LKedward <laurence.kedward@bristol.ac.uk> | 2020-09-07 10:10:02 +0100 |
commit | dd6ac6fc0fedd377bb95f92616aec29a01f0dcbf (patch) | |
tree | 262eb80e53573dc63fd9cf6b47c20b9dbea03b2c | |
parent | 44a848eaee454a486f08d389845b31d58a02f2c0 (diff) | |
download | fpm-dd6ac6fc0fedd377bb95f92616aec29a01f0dcbf.tar.gz fpm-dd6ac6fc0fedd377bb95f92616aec29a01f0dcbf.zip |
Fix: for windows paths
Adds windows_path filesystem function to convert to windows compatible paths
-rw-r--r-- | fpm/src/fpm_filesystem.f90 | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/fpm/src/fpm_filesystem.f90 b/fpm/src/fpm_filesystem.f90 index 59be19a..8d92ced 100644 --- a/fpm/src/fpm_filesystem.f90 +++ b/fpm/src/fpm_filesystem.f90 @@ -5,7 +5,7 @@ implicit none private public :: basename, join_path, number_of_rows, read_lines, list_files,& - mkdir, exists, get_temp_filename + mkdir, exists, get_temp_filename, windows_path integer, parameter :: LINE_BUFFER_LEN = 1000 @@ -119,8 +119,8 @@ subroutine mkdir(dir) call execute_command_line("mkdir -p " // dir , exitstat=stat) write(*,*) "mkdir -p " // dir case (OS_WINDOWS) - call execute_command_line("mkdir " // dir, exitstat=stat) - write(*,*) "mkdir " // dir + call execute_command_line("mkdir " // windows_path(dir), exitstat=stat) + write(*,*) "mkdir " // windows_path(dir) end select if (stat /= 0) then print *, "execute_command_line() failed" @@ -153,7 +153,7 @@ subroutine list_files(dir, files) call execute_command_line("ls " // dir // " > "//temp_file, & exitstat=stat) case (OS_WINDOWS) - call execute_command_line("dir /b " // dir // " > "//temp_file, & + call execute_command_line("dir /b " // windows_path(dir) // " > "//temp_file, & exitstat=stat) end select if (stat /= 0) then @@ -213,4 +213,18 @@ function get_temp_filename() result(tempfile) end function get_temp_filename +function windows_path(path) result(winpath) + ! Replace file system separators for windows + ! + character(*), intent(in) :: path + character(:), allocatable :: winpath + + winpath = path + + do while(index(winpath,'/') > 0) + winpath(index(winpath,'/'):index(winpath,'/')) = '\' + end do + +end function windows_path + end module fpm_filesystem |