From 8ae70a942f606b73d0313a80cde1751f4541c2ae Mon Sep 17 00:00:00 2001 From: Alexis Christoforides Date: Fri, 9 Aug 2019 17:13:16 +0300 Subject: [PATCH] Fix use of Span.Slice(int start() introduced in https://github.com/mono/mono/pull/16049 (#324) --- .../src/System/IO/FileSystemWatcher.OSX.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs b/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs index cd124256af9d..f451ab60e87d 100644 --- a/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs +++ b/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs @@ -437,7 +437,7 @@ private unsafe void ProcessEvents(int numEvents, ReadOnlySpan relativePath = ReadOnlySpan.Empty; if (!path.Equals(_fullDirectory, StringComparison.OrdinalIgnoreCase) && path.Length >= _fullDirectory.Length - && _fullDirectory.AsSpan().Equals(path.Slice(_fullDirectory.Length), StringComparison.OrdinalIgnoreCase)) + && _fullDirectory.AsSpan().Equals(path.Slice(0, _fullDirectory.Length), StringComparison.OrdinalIgnoreCase)) { // Remove the root directory to get the relative path relativePath = path.Slice(_fullDirectory.Length);