aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/LibraryManager.cs
diff options
context:
space:
mode:
authorErwin de Haan <EraYaN@users.noreply.github.com>2018-12-30 01:12:33 +0100
committerErwin de Haan <EraYaN@users.noreply.github.com>2018-12-30 01:12:33 +0100
commitde7fcaadb3d8fa77802ddcfb9bbd5b9306c49224 (patch)
treecbe066dc2b0cbd284d4670e8ed771361e211bb4e /Emby.Server.Implementations/Library/LibraryManager.cs
parent1f0b83c66a9946e12dba48b6457a1424a34ca87f (diff)
Fixed #320 by adding an extension method to BaseItem to make a deep copy of an object.
Diffstat (limited to 'Emby.Server.Implementations/Library/LibraryManager.cs')
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index 91e58bfcd..f25688bba 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -730,8 +730,10 @@ namespace Emby.Server.Implementations.Library
_fileSystem.CreateDirectory(rootFolderPath);
- var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(_fileSystem.GetDirectoryInfo(rootFolderPath));
-
+ var tmpAFolder = new AggregateFolder();
+ ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(rootFolderPath))).DeepCopy<Folder,AggregateFolder>(tmpAFolder);
+ var rootFolder = GetItemById(GetNewItemId(rootFolderPath, typeof(AggregateFolder))) as AggregateFolder ?? tmpAFolder;
+
// In case program data folder was moved
if (!string.Equals(rootFolder.Path, rootFolderPath, StringComparison.Ordinal))
{
@@ -799,7 +801,8 @@ namespace Emby.Server.Implementations.Library
if (tmpItem == null)
{
- tmpItem = (UserRootFolder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath));
+ tmpItem = new UserRootFolder();
+ ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath))).DeepCopy<Folder,UserRootFolder>(tmpItem);
}
// In case program data folder was moved