File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change 22//! of available tool versions.
33
44use std:: collections:: BTreeSet ;
5+ use std:: ffi:: OsStr ;
56use std:: path:: Path ;
67
78use crate :: error:: { Context , ErrorKind , Fallible } ;
@@ -60,11 +61,15 @@ pub fn package_configs() -> Fallible<BTreeSet<PackageConfig>> {
6061 // debug output, though
6162 . filter_map ( |entry| match entry {
6263 Ok ( dir_entry) => {
63- // Ignore directory entries.
64- if dir_entry. file_type ( ) . is_file ( ) {
65- Some ( dir_entry. into_path ( ) )
66- } else {
67- None
64+ // Ignore directory entries and any files that don't have a .json extension.
65+ // This will prevent us from trying to parse OS-generated files as package
66+ // configs (e.g. `.DS_Store` on macOS)
67+ let extension = dir_entry. path ( ) . extension ( ) . and_then ( OsStr :: to_str) ;
68+ match ( dir_entry. file_type ( ) . is_file ( ) , extension) {
69+ ( true , Some ( ext) ) if ext. eq_ignore_ascii_case ( "json" ) => {
70+ Some ( dir_entry. into_path ( ) )
71+ }
72+ _ => None ,
6873 }
6974 }
7075 Err ( e) => {
You can’t perform that action at this time.
0 commit comments