File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,11 @@ pub struct DirectoryPackage {
3636
3737impl DirectoryPackage {
3838 pub fn new ( path : PathBuf , copy : bool ) -> Result < Self > {
39- validate_installer_version ( & path) ?;
39+ let file = utils:: read_file ( "installer version" , & path. join ( VERSION_FILE ) ) ?;
40+ let v = file. trim ( ) ;
41+ if v != INSTALLER_VERSION {
42+ return Err ( anyhow ! ( format!( "unsupported installer version: {v}" ) ) ) ;
43+ }
4044
4145 let content = utils:: read_file ( "package components" , & path. join ( "components" ) ) ?;
4246 let components = content. lines ( ) . map ( ToOwned :: to_owned) . collect ( ) ;
@@ -46,19 +50,7 @@ impl DirectoryPackage {
4650 copy,
4751 } )
4852 }
49- }
50-
51- fn validate_installer_version ( path : & Path ) -> Result < ( ) > {
52- let file = utils:: read_file ( "installer version" , & path. join ( VERSION_FILE ) ) ?;
53- let v = file. trim ( ) ;
54- if v == INSTALLER_VERSION {
55- Ok ( ( ) )
56- } else {
57- Err ( anyhow ! ( format!( "unsupported installer version: {v}" ) ) )
58- }
59- }
6053
61- impl DirectoryPackage {
6254 pub fn contains ( & self , component : & str , short_name : Option < & str > ) -> bool {
6355 self . components . contains ( component)
6456 || if let Some ( n) = short_name {
You can’t perform that action at this time.
0 commit comments