@@ -26,15 +26,6 @@ const OVMF_PREBUILT_SOURCE: Source = Source::EDK2_STABLE202502_R2;
26
26
/// Directory into which the prebuilts will be download (relative to the repo root).
27
27
const OVMF_PREBUILT_DIR : & str = "target/ovmf" ;
28
28
29
- /// Environment variable for overriding the path of the OVMF code file.
30
- const ENV_VAR_OVMF_CODE : & str = "OVMF_CODE" ;
31
-
32
- /// Environment variable for overriding the path of the OVMF vars file.
33
- const ENV_VAR_OVMF_VARS : & str = "OVMF_VARS" ;
34
-
35
- /// Environment variable for overriding the path of the OVMF shell file.
36
- const ENV_VAR_OVMF_SHELL : & str = "OVMF_SHELL" ;
37
-
38
29
impl From < UefiArch > for ovmf_prebuilt:: Arch {
39
30
fn from ( arch : UefiArch ) -> Self {
40
31
match arch {
@@ -47,29 +38,13 @@ impl From<UefiArch> for ovmf_prebuilt::Arch {
47
38
48
39
/// Get a user-provided path for the given OVMF file type.
49
40
///
50
- /// This uses the command-line arg if present, otherwise it falls back to an
51
- /// environment variable. If neither is present, returns `None` .
41
+ /// This can come from an explicit CLI arg or an environment variable, depending
42
+ /// on how clap received and parsed the value .
52
43
fn get_user_provided_path ( file_type : FileType , opt : & QemuOpt ) -> Option < PathBuf > {
53
- let opt_path;
54
- let var_name;
55
44
match file_type {
56
- FileType :: Code => {
57
- opt_path = & opt. ovmf_code ;
58
- var_name = ENV_VAR_OVMF_CODE ;
59
- }
60
- FileType :: Vars => {
61
- opt_path = & opt. ovmf_vars ;
62
- var_name = ENV_VAR_OVMF_VARS ;
63
- }
64
- FileType :: Shell => {
65
- opt_path = & opt. ovmf_shell ;
66
- var_name = ENV_VAR_OVMF_SHELL ;
67
- }
68
- }
69
- if let Some ( path) = opt_path {
70
- Some ( path. clone ( ) )
71
- } else {
72
- env:: var_os ( var_name) . map ( PathBuf :: from)
45
+ FileType :: Code => opt. ovmf_code . clone ( ) ,
46
+ FileType :: Vars => opt. ovmf_vars . clone ( ) ,
47
+ FileType :: Shell => opt. ovmf_shell . clone ( ) ,
73
48
}
74
49
}
75
50
0 commit comments