From ed34b67f512b07ea2e97f8708811cc4150906f12 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 2 Nov 2013 15:30:29 -0400 Subject: fix library scan stopping and restarting itself --- .../IO/DirectoryWatchers.cs | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/IO') diff --git a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs index 330469877a..748ba0df47 100644 --- a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs +++ b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs @@ -361,7 +361,33 @@ namespace MediaBrowser.Server.Implementations.IO if (e.ChangeType == WatcherChangeTypes.Changed) { // If the parent of an ignored path has a change event, ignore that too - if (tempIgnorePaths.Any(i => string.Equals(Path.GetDirectoryName(i), e.FullPath, StringComparison.OrdinalIgnoreCase) || string.Equals(i, e.FullPath, StringComparison.OrdinalIgnoreCase))) + if (tempIgnorePaths.Any(i => + { + if (string.Equals(i, e.FullPath, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + // Go up a level + var parent = Path.GetDirectoryName(i); + if (string.Equals(parent, e.FullPath, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + // Go up another level + if (!string.IsNullOrEmpty(parent)) + { + parent = Path.GetDirectoryName(i); + if (string.Equals(parent, e.FullPath, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + + return false; + + })) { return; } -- cgit v1.2.3