@@ -22,7 +22,6 @@ use std::panic;
2222use std:: path:: { Path , PathBuf } ;
2323
2424pub use gimli;
25- pub use glob;
2625pub use object;
2726pub use regex;
2827pub use wasmparser;
@@ -209,40 +208,15 @@ pub fn bin_name(name: &str) -> String {
209208 if is_windows ( ) { format ! ( "{name}.exe" ) } else { name. to_string ( ) }
210209}
211210
212- /// Remove all dynamic libraries possessing a name starting with `paths`.
211+ /// Count the number of files in the current
212+ /// working directory possessing the extension `ext`.
213213#[ track_caller]
214- pub fn remove_dylibs ( paths : & str ) {
215- let paths = format ! ( r"{paths}*" ) ;
216- remove_glob ( dynamic_lib_name ( & paths) . as_str ( ) ) ;
217- }
218-
219- /// Remove all rust libraries possessing a name starting with `paths`.
220- #[ track_caller]
221- pub fn remove_rlibs ( paths : & str ) {
222- let paths = format ! ( r"{paths}*" ) ;
223- remove_glob ( rust_lib_name ( & paths) . as_str ( ) ) ;
224- }
225-
226- #[ track_caller]
227- fn remove_glob ( paths : & str ) {
228- let paths = glob:: glob ( paths) . expect ( format ! ( "Glob expression {paths} is not valid." ) . as_str ( ) ) ;
229- paths
214+ pub fn count_files_with_extension ( ext : & str ) -> usize {
215+ fs_wrapper:: read_dir ( cwd ( ) )
230216 . filter_map ( |entry| entry. ok ( ) )
231- . filter ( |entry| entry. as_path ( ) . is_file ( ) )
232- . for_each ( |file| fs_wrapper:: remove_file ( & file) ) ;
233- }
234-
235- #[ track_caller]
236- fn count_glob ( paths : & str ) -> usize {
237- let paths = glob:: glob ( paths) . expect ( format ! ( "Glob expression {paths} is not valid." ) . as_str ( ) ) ;
238- paths. filter_map ( |entry| entry. ok ( ) ) . filter ( |entry| entry. as_path ( ) . is_file ( ) ) . count ( )
239- }
240-
241- /// Count the number of rust libraries possessing a name starting with `paths`.
242- #[ track_caller]
243- pub fn count_rlibs ( paths : & str ) -> usize {
244- let paths = format ! ( r"{paths}*" ) ;
245- count_glob ( rust_lib_name ( & paths) . as_str ( ) )
217+ . filter ( |entry| entry. path ( ) . is_file ( ) )
218+ . filter ( |entry| entry. path ( ) . extension ( ) . unwrap ( ) == ext)
219+ . count ( )
246220}
247221
248222/// Return the current working directory.
0 commit comments