re-factored some file system access

This commit is contained in:
Luke Pulverenti
2013-06-03 22:02:49 -04:00
parent 08d9004d8f
commit 02fedead11
24 changed files with 339 additions and 258 deletions

View File

@@ -304,7 +304,6 @@ namespace MediaBrowser.Controller.Entities
/// <summary>
/// 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
/// </summary>
/// <value>The resolve args.</value>
[IgnoreDataMember]

View File

@@ -19,10 +19,6 @@ namespace MediaBrowser.Controller.Entities
public static IUserManager UserManager { get; set; }
public static IXmlSerializer XmlSerializer { get; set; }
/// <summary>
/// The _root folder path
/// </summary>
private string _rootFolderPath;
/// <summary>
/// Gets the root folder path.
/// </summary>
@@ -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;
}
}