@@ -115,6 +115,14 @@ pub fn copy_files_except_ext(
115
115
. metadata ( )
116
116
. with_context ( || format ! ( "Failed to read {:?}" , entry. path( ) ) ) ?;
117
117
118
+ // Check if it is in the blacklist
119
+ if let Some ( ignore) = ignore {
120
+ let path = entry. path ( ) ;
121
+ if ignore. matched ( & path, path. is_dir ( ) ) . is_ignore ( ) {
122
+ continue ;
123
+ }
124
+ }
125
+
118
126
// If the entry is a dir and the recursive option is enabled, call itself
119
127
if metadata. is_dir ( ) && recursive {
120
128
if entry. path ( ) == to. to_path_buf ( ) {
@@ -127,13 +135,6 @@ pub fn copy_files_except_ext(
127
135
}
128
136
}
129
137
130
- if let Some ( ignore) = ignore {
131
- let path = entry. path ( ) ;
132
- if ignore. matched ( & path, path. is_dir ( ) ) . is_ignore ( ) {
133
- continue ;
134
- }
135
- }
136
-
137
138
// check if output dir already exists
138
139
if !to. join ( entry. file_name ( ) ) . exists ( ) {
139
140
fs:: create_dir ( & to. join ( entry. file_name ( ) ) ) ?;
@@ -147,14 +148,6 @@ pub fn copy_files_except_ext(
147
148
ignore,
148
149
) ?;
149
150
} else if metadata. is_file ( ) {
150
- // Check if it is in the blacklist
151
- if let Some ( ignore) = ignore {
152
- let path = entry. path ( ) ;
153
- if ignore. matched ( & path, path. is_dir ( ) ) . is_ignore ( ) {
154
- continue ;
155
- }
156
- }
157
-
158
151
debug ! (
159
152
"creating path for file: {:?}" ,
160
153
& to. join(
0 commit comments