More thread safety.
This commit is contained in:
parent
5f8c40962a
commit
406aea6ead
@ -94,20 +94,26 @@ namespace FileManager
|
||||
}
|
||||
|
||||
private void RemovePath(string path)
|
||||
{
|
||||
lock (fsCache)
|
||||
{
|
||||
var pathsToRemove = fsCache.Where(p => p.StartsWith(path)).ToArray();
|
||||
|
||||
foreach (var p in pathsToRemove)
|
||||
fsCache.Remove(p);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddPath(string path)
|
||||
{
|
||||
lock (fsCache)
|
||||
{
|
||||
if (File.GetAttributes(path).HasFlag(FileAttributes.Directory))
|
||||
fsCache.AddRange(Directory.EnumerateFiles(path, SearchPattern, SearchOption));
|
||||
else
|
||||
fsCache.Add(path);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user