1
1
module test_os
2
2
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
5
5
use fpm_os, only: get_absolute_path, get_absolute_path_by_cd, get_current_directory
6
6
7
7
implicit none
@@ -134,7 +134,7 @@ subroutine abs_path_nonexisting(error)
134
134
subroutine abs_path_root (error )
135
135
type (error_t), allocatable , intent (out ) :: error
136
136
137
- character (len= :), allocatable :: home_drive, home_path, result
137
+ character (len= :), allocatable :: home_path, result
138
138
139
139
if (os_is_unix()) then
140
140
call get_absolute_path(' /' , result, error)
@@ -144,8 +144,7 @@ subroutine abs_path_root(error)
144
144
call test_failed(error, " Result '" // result// " ' doesn't equal input value: '/'" ); return
145
145
end if
146
146
else
147
- call env_variable(home_drive, ' HOMEDRIVE' )
148
- home_path = home_drive// ' \'
147
+ home_path = get_env(' HOMEDRIVE' ,' ' ) // ' \'
149
148
150
149
call get_absolute_path(home_path, result, error)
151
150
if (allocated (error)) return
@@ -177,7 +176,7 @@ subroutine abs_path_home(error)
177
176
subroutine abs_path_cd_root (error )
178
177
type (error_t), allocatable , intent (out ) :: error
179
178
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
181
180
182
181
call get_current_directory(current_dir_before, error)
183
182
if (allocated (error)) return
@@ -189,8 +188,7 @@ subroutine abs_path_cd_root(error)
189
188
call test_failed(error, " Result '" // result// " ' doesn't equal input value: '/'" ); return
190
189
end if
191
190
else
192
- call env_variable(home_drive, ' HOMEDRIVE' )
193
- home_path = home_drive// ' \'
191
+ home_path = get_env(' HOMEDRIVE' ,' ' )// ' \'
194
192
195
193
call get_absolute_path_by_cd(home_path, result, error)
196
194
0 commit comments