@@ -7,7 +7,7 @@ use crate::dir::{
77use crate :: dump48;
88use crate :: part:: {
99 fpt:: { DIR_PARTS , FPT , FPTEntry , FS_PARTS , FTPR , REMOVABLE_PARTS } ,
10- part:: { Partition , UnknownOrMalformedPartition , dir_clean, strs_to_strings} ,
10+ part:: { ClearOptions , Partition , UnknownOrMalformedPartition , dir_clean, strs_to_strings} ,
1111} ;
1212
1313#[ derive( Serialize , Deserialize , Clone , Debug ) ]
@@ -148,7 +148,7 @@ pub fn parse(fpt: &FPT, data: &[u8], debug: bool) -> Vec<Gen3Partition> {
148148 parts
149149}
150150
151- pub fn clean ( parts : & Vec < Gen3Partition > ) -> Vec < Gen3Partition > {
151+ pub fn clean ( parts : & Vec < Gen3Partition > , options : & ClearOptions ) -> Vec < Gen3Partition > {
152152 use log:: info;
153153 // Step 1: Reduce down to the partitions to be kept, i.e., non-removable
154154 // ones.
@@ -166,6 +166,9 @@ pub fn clean(parts: &Vec<Gen3Partition>) -> Vec<Gen3Partition> {
166166 } )
167167 . map ( |p| p. clone ( ) )
168168 . collect :: < Vec < Gen3Partition > > ( ) ;
169+ if options. keep_modules {
170+ return reduced;
171+ }
169172 // Step 2: Clean the FTPR directory, retaining non-removable modules.
170173 if let Some ( p) = reduced. iter_mut ( ) . find ( |p| p. entry ( ) . name ( ) == FTPR ) {
171174 let offset = p. entry ( ) . offset ( ) ;
0 commit comments