File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,34 @@ impl Scanner {
219
219
self . files . extend ( files) ;
220
220
self . globs . extend ( globs) ;
221
221
}
222
+
223
+ // Find all `@source` globs that point to a directory. If so, promote the source to auto
224
+ // source detection instead.
225
+ if let Some ( sources) = & mut self . sources {
226
+ for source in sources {
227
+ // If a glob ends with `**/*`, then we just want to register the base path as a new
228
+ // base.
229
+ if source. pattern . ends_with ( "**/*" ) {
230
+ source. pattern = source. pattern . trim_end_matches ( "**/*" ) . to_owned ( ) ;
231
+ }
232
+
233
+ let path = PathBuf :: from ( & source. base ) . join ( & source. pattern ) ;
234
+ if let Some ( folder_name) = path. file_name ( ) {
235
+ // Contains a file extension, e.g.: `foo.html`, therefore we don't want to
236
+ // detect sources here.
237
+ if folder_name. to_str ( ) . unwrap ( ) . contains ( "." ) {
238
+ continue ;
239
+ }
240
+
241
+ // Promote to auto source detection
242
+ let detect_sources = DetectSources :: new ( path. clone ( ) ) ;
243
+
244
+ let ( files, globs) = detect_sources. detect ( ) ;
245
+ self . files . extend ( files) ;
246
+ self . globs . extend ( globs) ;
247
+ }
248
+ }
249
+ }
222
250
}
223
251
224
252
#[ tracing:: instrument( skip_all) ]
You can’t perform that action at this time.
0 commit comments