Skip to content

Commit b6a3c62

Browse files
committed
Update
1 parent ad60326 commit b6a3c62

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

Diff for: src/Files.App.Storage/Watchers/RecycleBinWatcher.cs

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2024 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4+
using Files.Shared.Extensions;
45
using System.Security.Principal;
56

67
namespace Files.App.Storage.Watchers
@@ -15,9 +16,6 @@ public class RecycleBinWatcher : ITrashWatcher
1516
/// <inheritdoc/>
1617
public event EventHandler<SystemIO.FileSystemEventArgs>? ItemDeleted;
1718

18-
/// <inheritdoc/>
19-
public event EventHandler<SystemIO.FileSystemEventArgs>? ItemChanged;
20-
2119
/// <inheritdoc/>
2220
public event EventHandler<SystemIO.FileSystemEventArgs>? ItemRenamed;
2321

@@ -35,16 +33,13 @@ public RecycleBinWatcher()
3533
/// <inheritdoc/>
3634
public void StartWatcher()
3735
{
38-
// NOTE:
39-
// SHChangeNotifyRegister only works if recycle bin is open in File Explorer.
40-
// Create file system watcher to monitor recycle bin folder(s) instead.
36+
// NOTE: SHChangeNotifyRegister only works if recycle bin is open in File Explorer.
4137

4238
// Listen changes only on the Recycle Bin that the current logon user has
4339
var sid = WindowsIdentity.GetCurrent().User?.ToString() ?? string.Empty;
4440
if (string.IsNullOrEmpty(sid))
4541
return;
4642

47-
// TODO: Use IStorageDevicesService to enumerate drives
4843
foreach (var drive in SystemIO.DriveInfo.GetDrives())
4944
{
5045
var recyclePath = SystemIO.Path.Combine(drive.Name, "$RECYCLE.BIN", sid);
@@ -53,7 +48,7 @@ public void StartWatcher()
5348
!SystemIO.Directory.Exists(recyclePath))
5449
continue;
5550

56-
// NOTE: Supress #15808
51+
// NOTE: Suppressed NullReferenceException caused by EnableRaisingEvents in #15808
5752
SafetyExtensions.IgnoreExceptions(() =>
5853
{
5954
SystemIO.FileSystemWatcher watcher = new()

Diff for: src/Files.Core.Storage/Contracts/ITrashWatcher.cs

-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ public interface ITrashWatcher : IWatcher
1515
/// </summary>
1616
event EventHandler<SystemIO.FileSystemEventArgs>? ItemDeleted;
1717

18-
/// <summary>
19-
/// Gets invoked when an item changing is detected by the watcher
20-
/// </summary>
21-
event EventHandler<SystemIO.FileSystemEventArgs>? ItemChanged;
22-
2318
/// <summary>
2419
/// Gets invoked when an item renaming is detected by the watcher
2520
/// </summary>

0 commit comments

Comments
 (0)