File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
src/Files.App/Utils/RecycleBin Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -51,18 +51,21 @@ private void StartRecycleBinWatcher()
5151 if ( drive . DriveType == SystemIO . DriveType . Network || ! SystemIO . Directory . Exists ( recyclePath ) )
5252 continue ;
5353
54- SystemIO . FileSystemWatcher watcher = new ( )
54+ SafetyExtensions . IgnoreExceptions ( ( ) =>
5555 {
56- Path = recyclePath ,
57- Filter = "*.*" ,
58- NotifyFilter = SystemIO . NotifyFilters . LastWrite | SystemIO . NotifyFilters . FileName | SystemIO . NotifyFilters . DirectoryName
59- } ;
60-
61- watcher . Created += RecycleBinWatcher_Changed ;
62- watcher . Deleted += RecycleBinWatcher_Changed ;
63- watcher . EnableRaisingEvents = true ;
64-
65- binWatchers . Add ( watcher ) ;
56+ SystemIO . FileSystemWatcher watcher = new ( )
57+ {
58+ Path = recyclePath ,
59+ Filter = "*.*" ,
60+ NotifyFilter = SystemIO . NotifyFilters . LastWrite | SystemIO . NotifyFilters . FileName | SystemIO . NotifyFilters . DirectoryName
61+ } ;
62+
63+ watcher . Created += RecycleBinWatcher_Changed ;
64+ watcher . Deleted += RecycleBinWatcher_Changed ;
65+ watcher . EnableRaisingEvents = true ;
66+
67+ binWatchers . Add ( watcher ) ;
68+ } ) ;
6669 }
6770 }
6871
You can’t perform that action at this time.
0 commit comments