more sync movement

This commit is contained in:
Luke Pulverenti
2014-12-12 22:56:30 -05:00
parent 3fb40eb02e
commit ab3da46113
49 changed files with 1001 additions and 149 deletions

View File

@@ -736,16 +736,27 @@ namespace MediaBrowser.Server.Implementations.Library
}
private UserRootFolder _userRootFolder;
private readonly object _syncLock = new object();
public Folder GetUserRootFolder()
{
if (_userRootFolder == null)
{
var userRootPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
lock (_syncLock)
{
if (_userRootFolder == null)
{
var userRootPath = ConfigurationManager.ApplicationPaths.DefaultUserViewsPath;
Directory.CreateDirectory(userRootPath);
Directory.CreateDirectory(userRootPath);
_userRootFolder = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder ??
(UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));
_userRootFolder = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder;
if (_userRootFolder == null)
{
_userRootFolder = (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));
}
}
}
}
return _userRootFolder;