aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Providers/DirectoryService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Providers/DirectoryService.cs')
-rw-r--r--MediaBrowser.Controller/Providers/DirectoryService.cs20
1 files changed, 19 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs
index 9d41b6d25..6f70df435 100644
--- a/MediaBrowser.Controller/Providers/DirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/DirectoryService.cs
@@ -11,6 +11,7 @@ namespace MediaBrowser.Controller.Providers
{
List<FileSystemInfo> GetFileSystemEntries(string path);
IEnumerable<FileSystemInfo> GetFiles(string path);
+ IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache);
FileSystemInfo GetFile(string path);
}
@@ -27,8 +28,20 @@ namespace MediaBrowser.Controller.Providers
public List<FileSystemInfo> GetFileSystemEntries(string path)
{
+ return GetFileSystemEntries(path, false);
+ }
+
+ private List<FileSystemInfo> GetFileSystemEntries(string path, bool clearCache)
+ {
List<FileSystemInfo> entries;
+ if (clearCache)
+ {
+ List<FileSystemInfo> removed;
+
+ _cache.TryRemove(path, out removed);
+ }
+
if (!_cache.TryGetValue(path, out entries))
{
//_logger.Debug("Getting files for " + path);
@@ -50,7 +63,12 @@ namespace MediaBrowser.Controller.Providers
public IEnumerable<FileSystemInfo> GetFiles(string path)
{
- return GetFileSystemEntries(path).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory);
+ return GetFiles(path, false);
+ }
+
+ public IEnumerable<FileSystemInfo> GetFiles(string path, bool clearCache)
+ {
+ return GetFileSystemEntries(path, clearCache).Where(i => (i.Attributes & FileAttributes.Directory) != FileAttributes.Directory);
}
public FileSystemInfo GetFile(string path)