From 02fedead11f738c09e503c3bdc74e2dd98e21cc8 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 3 Jun 2013 22:02:49 -0400 Subject: re-factored some file system access --- MediaBrowser.Controller/Entities/BaseItem.cs | 1 - MediaBrowser.Controller/Entities/User.cs | 26 ++++++++------------------ 2 files changed, 8 insertions(+), 19 deletions(-) (limited to 'MediaBrowser.Controller/Entities') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index ef1efd8af9..f5aed6d214 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -304,7 +304,6 @@ namespace MediaBrowser.Controller.Entities /// /// We attach these to the item so that we only ever have to hit the file system once /// (this includes the children of the containing folder) - /// Use ResolveArgs.FileSystemDictionary to check for the existence of files instead of File.Exists /// /// The resolve args. [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index e186119d6a..65884332aa 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -19,10 +19,6 @@ namespace MediaBrowser.Controller.Entities public static IUserManager UserManager { get; set; } public static IXmlSerializer XmlSerializer { get; set; } - /// - /// The _root folder path - /// - private string _rootFolderPath; /// /// Gets the root folder path. /// @@ -32,23 +28,19 @@ namespace MediaBrowser.Controller.Entities { get { - if (_rootFolderPath == null) + if (Configuration.UseCustomLibrary) { - if (Configuration.UseCustomLibrary) - { - _rootFolderPath = GetRootFolderPath(Name); + var rootFolderPath = GetRootFolderPath(Name); - if (!Directory.Exists(_rootFolderPath)) - { - Directory.CreateDirectory(_rootFolderPath); - } - } - else + if (!Directory.Exists(rootFolderPath)) { - _rootFolderPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath; + Directory.CreateDirectory(rootFolderPath); } + + return rootFolderPath; } - return _rootFolderPath; + + return ConfigurationManager.ApplicationPaths.DefaultUserViewsPath; } } @@ -261,7 +253,6 @@ namespace MediaBrowser.Controller.Entities // Force these to be lazy loaded again _configurationDirectoryPath = null; - _rootFolderPath = null; RootFolder = null; // Kick off a task to validate the media library @@ -378,7 +369,6 @@ namespace MediaBrowser.Controller.Entities // Force these to be lazy loaded again if (customLibraryChanged) { - _rootFolderPath = null; RootFolder = null; } } -- cgit v1.2.3