@@ -26,15 +26,6 @@ const OVMF_PREBUILT_SOURCE: Source = Source::EDK2_STABLE202502_R2;
2626/// Directory into which the prebuilts will be download (relative to the repo root).
2727const OVMF_PREBUILT_DIR : & str = "target/ovmf" ;
2828
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-
3829impl From < UefiArch > for ovmf_prebuilt:: Arch {
3930 fn from ( arch : UefiArch ) -> Self {
4031 match arch {
@@ -47,29 +38,13 @@ impl From<UefiArch> for ovmf_prebuilt::Arch {
4738
4839/// Get a user-provided path for the given OVMF file type.
4940///
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 .
5243fn get_user_provided_path ( file_type : FileType , opt : & QemuOpt ) -> Option < PathBuf > {
53- let opt_path;
54- let var_name;
5544 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 ( ) ,
7348 }
7449}
7550
0 commit comments