@@ -22,7 +22,6 @@ use std::panic;
22
22
use std:: path:: { Path , PathBuf } ;
23
23
24
24
pub use gimli;
25
- pub use glob;
26
25
pub use object;
27
26
pub use regex;
28
27
pub use wasmparser;
@@ -209,40 +208,15 @@ pub fn bin_name(name: &str) -> String {
209
208
if is_windows ( ) { format ! ( "{name}.exe" ) } else { name. to_string ( ) }
210
209
}
211
210
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`.
213
213
#[ 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 ( ) )
230
216
. 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 ( )
246
220
}
247
221
248
222
/// Return the current working directory.
0 commit comments