File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -375,19 +375,27 @@ fn create_watcher(
375
375
) -> notify:: Result < notify:: RecommendedWatcher > {
376
376
let mut config_patterns = GlobSetBuilder :: new ( ) ;
377
377
for filename in CONFIG_FILENAMES {
378
- config_patterns. add ( Glob :: new ( & format ! ( "**/{ filename}" ) ) . unwrap ( ) ) ;
378
+ config_patterns. add ( Glob :: new ( filename) . unwrap ( ) ) ;
379
379
}
380
380
let config_patterns = config_patterns. build ( ) . unwrap ( ) ;
381
381
382
+ let base_dir = project_dir. to_owned ( ) ;
382
383
let mut watcher =
383
384
notify:: recommended_watcher ( move |res : notify:: Result < notify:: Event > | match res {
384
385
Ok ( event) => {
385
- if matches ! ( event. kind, notify:: EventKind :: Modify ( ..) ) {
386
+ if matches ! (
387
+ event. kind,
388
+ notify:: EventKind :: Modify ( ..)
389
+ | notify:: EventKind :: Create ( ..)
390
+ | notify:: EventKind :: Remove ( ..)
391
+ ) {
386
392
for path in & event. paths {
393
+ let Ok ( path) = path. strip_prefix ( & base_dir) else {
394
+ continue ;
395
+ } ;
387
396
if config_patterns. is_match ( path) {
388
397
config_modified. store ( true , Ordering :: Relaxed ) ;
389
- }
390
- if patterns. is_match ( path) {
398
+ } else if patterns. is_match ( path) {
391
399
modified. store ( true , Ordering :: Relaxed ) ;
392
400
}
393
401
}
You can’t perform that action at this time.
0 commit comments