aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-06-09 09:31:37 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-06-09 09:31:37 -0400
commit7ceb377cde65e4867937d0cb38475ad72dfe4441 (patch)
tree2cf0054d519b26a9060bebc1ed73884039777201
parentfb4c559549315ee636005a9828717a55c58eae5b (diff)
better comparison of names in directory watchers
-rw-r--r--MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs18
1 files changed, 10 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs
index 855397a17..e513b4774 100644
--- a/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs
+++ b/MediaBrowser.Server.Implementations/IO/DirectoryWatchers.cs
@@ -41,7 +41,7 @@ namespace MediaBrowser.Server.Implementations.IO
/// <summary>
/// Any file name ending in any of these will be ignored by the watchers
/// </summary>
- private readonly List<string> _alwaysIgnoreFiles = new List<string> { "thumbs.db", "small.jpg", "albumart.jpg" };
+ private readonly IReadOnlyList<string> _alwaysIgnoreFiles = new List<string> { "thumbs.db", "small.jpg", "albumart.jpg" };
/// <summary>
/// The timer lock
@@ -322,8 +322,16 @@ namespace MediaBrowser.Server.Implementations.IO
/// <param name="e">The <see cref="FileSystemEventArgs" /> instance containing the event data.</param>
void watcher_Changed(object sender, FileSystemEventArgs e)
{
+ var name = e.Name;
+
+ // Ignore certain files
+ if (_alwaysIgnoreFiles.Contains(name, StringComparer.OrdinalIgnoreCase))
+ {
+ return;
+ }
+
// Ignore when someone manually creates a new folder
- if (e.ChangeType == WatcherChangeTypes.Created && e.Name == "New folder")
+ if (e.ChangeType == WatcherChangeTypes.Created && name == "New folder")
{
return;
}
@@ -339,12 +347,6 @@ namespace MediaBrowser.Server.Implementations.IO
}
}
- // Ignore certain files
- if (_alwaysIgnoreFiles.Any(f => e.Name.EndsWith(f, StringComparison.OrdinalIgnoreCase)))
- {
- return;
- }
-
if (tempIgnorePaths.Contains(e.FullPath, StringComparer.OrdinalIgnoreCase))
{
Logger.Debug("Watcher requested to ignore change to " + e.FullPath);