@@ -660,11 +660,13 @@ public static void WatchProgramUpdate(Settings settings)
660
660
if ( settings . EnableStartMenuSource )
661
661
paths . AddRange ( GetStartMenuPaths ( ) ) ;
662
662
663
- paths . AddRange ( from source in settings . ProgramSources where source . Enabled select source . Location ) ;
663
+ var customSources = GetCommonParents ( settings . ProgramSources ) ;
664
+ paths . AddRange ( customSources ) ;
664
665
666
+ var fileExtensionToWatch = settings . GetSuffixes ( ) ;
665
667
foreach ( var directory in from path in paths where Directory . Exists ( path ) select path )
666
668
{
667
- WatchDirectory ( directory ) ;
669
+ WatchDirectory ( directory , fileExtensionToWatch ) ;
668
670
}
669
671
670
672
_ = Task . Run ( MonitorDirectoryChangeAsync ) ;
@@ -685,7 +687,7 @@ public static async Task MonitorDirectoryChangeAsync()
685
687
}
686
688
}
687
689
688
- public static void WatchDirectory ( string directory )
690
+ public static void WatchDirectory ( string directory , string [ ] extensions )
689
691
{
690
692
if ( ! Directory . Exists ( directory ) )
691
693
{
@@ -697,6 +699,9 @@ public static void WatchDirectory(string directory)
697
699
watcher . Deleted += static ( _ , _ ) => indexQueue . Writer . TryWrite ( default ) ;
698
700
watcher . EnableRaisingEvents = true ;
699
701
watcher . IncludeSubdirectories = true ;
702
+ foreach ( var extension in extensions ) {
703
+ watcher . Filters . Add ( $ "*.{ extension } ") ;
704
+ }
700
705
701
706
Watchers . Add ( watcher ) ;
702
707
}
0 commit comments