Commit 3b304fa
committed
Extract
This refactors `gix_path::env::system_prefix()` by extracting the
two strategies used to obtain it on Windows to newly created helper
functions: `system_prefix_from_exepath_var()` for the `EXEPATH`
optimization, and `system_prefix_from_core_dir()` for the fallback.
This is to facilitate testing. The new helpers take the functions
they call to obtain systemwide information (`EXEPATH` from the
environment, or the once-computed `GIT_CORE_DIR`) by dependency
injection, so tests can be added that cover the important cases.
This is similar to the approach for `ALTERNATIVE_LOCATIONS` of
using a `locations_under_program_files()` helper (since GitoxideLabs#1456). The
`system_prefix_from_exepath_var()` helper treats its `var_os_func`
parameter analogously to how `locations_under_program_files()`
treats its `var_os_func` parameter.system_prefix() Windows strategies to helpers1 parent 571ca6e commit 3b304fa
1 file changed
+27
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
142 | 167 | | |
143 | 168 | | |
144 | 169 | | |
| |||
153 | 178 | | |
154 | 179 | | |
155 | 180 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 181 | + | |
| 182 | + | |
170 | 183 | | |
171 | 184 | | |
172 | 185 | | |
| |||
0 commit comments