Skip to content

Commit f0337ab

Browse files
committed
change test_os.f90 accordingly
1 parent bac6f60 commit f0337ab

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

test/fpm_test/test_os.f90

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module test_os
22
use testsuite, only: new_unittest, unittest_t, error_t, test_failed
3-
use fpm_filesystem, only: env_variable, join_path, mkdir, os_delete_dir, is_dir, get_local_prefix, get_home
4-
use fpm_environment, only: os_is_unix
3+
use fpm_filesystem, only: join_path, mkdir, os_delete_dir, is_dir, get_local_prefix, get_home
4+
use fpm_environment, only: os_is_unix, get_env
55
use fpm_os, only: get_absolute_path, get_absolute_path_by_cd, get_current_directory
66

77
implicit none
@@ -134,7 +134,7 @@ subroutine abs_path_nonexisting(error)
134134
subroutine abs_path_root(error)
135135
type(error_t), allocatable, intent(out) :: error
136136

137-
character(len=:), allocatable :: home_drive, home_path, result
137+
character(len=:), allocatable :: home_path, result
138138

139139
if (os_is_unix()) then
140140
call get_absolute_path('/', result, error)
@@ -144,8 +144,7 @@ subroutine abs_path_root(error)
144144
call test_failed(error, "Result '"//result//"' doesn't equal input value: '/'"); return
145145
end if
146146
else
147-
call env_variable(home_drive, 'HOMEDRIVE')
148-
home_path = home_drive//'\'
147+
home_path = get_env('HOMEDRIVE','') //'\'
149148

150149
call get_absolute_path(home_path, result, error)
151150
if (allocated(error)) return
@@ -177,7 +176,7 @@ subroutine abs_path_home(error)
177176
subroutine abs_path_cd_root(error)
178177
type(error_t), allocatable, intent(out) :: error
179178

180-
character(len=:), allocatable :: home_drive, home_path, current_dir_before, current_dir_after, result
179+
character(len=:), allocatable :: home_path, current_dir_before, current_dir_after, result
181180

182181
call get_current_directory(current_dir_before, error)
183182
if (allocated(error)) return
@@ -189,8 +188,7 @@ subroutine abs_path_cd_root(error)
189188
call test_failed(error, "Result '"//result//"' doesn't equal input value: '/'"); return
190189
end if
191190
else
192-
call env_variable(home_drive, 'HOMEDRIVE')
193-
home_path = home_drive//'\'
191+
home_path = get_env('HOMEDRIVE','')//'\'
194192

195193
call get_absolute_path_by_cd(home_path, result, error)
196194

0 commit comments

Comments
 (0)