diff --git a/src/System/IO/SystemFolderWatcher.cs b/src/System/IO/SystemFolderWatcher.cs index 2c848c5..1c4b03e 100644 --- a/src/System/IO/SystemFolderWatcher.cs +++ b/src/System/IO/SystemFolderWatcher.cs @@ -119,7 +119,8 @@ private static IStorable CreateStorableFromPath(string path, bool minimalImpleme return new SystemFile(path); } - throw new ArgumentException($"Could not determine if the path '{path}' is a file or folder."); + // The item is most likely deleted. Return all available information through SimpleStorableItem + return new SimpleStorableItem(id: path, name: Path.GetFileName(path)); } private static bool IsFile(string path) => Path.GetFileName(path) is { } str && str != string.Empty && File.Exists(path); diff --git a/tests/OwlCore.Storage.Tests/SystemIO/IFolderTests.cs b/tests/OwlCore.Storage.Tests/SystemIO/IFolderTests.cs index 05426f7..fc8e70c 100644 --- a/tests/OwlCore.Storage.Tests/SystemIO/IFolderTests.cs +++ b/tests/OwlCore.Storage.Tests/SystemIO/IFolderTests.cs @@ -16,7 +16,7 @@ public override Task CreateModifiableFolderAsync() public override Task CreateModifiableFolderWithItems(int fileCount, int folderCount) { var tempFolder = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); - var dir = Directory.CreateDirectory(tempFolder); + _ = Directory.CreateDirectory(tempFolder); for (var i = 0; i < fileCount; i++) {