better comparison of names in directory watchers
This commit is contained in:
parent
fb4c559549
commit
7ceb377cde
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user