diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 2090558c81..b61b524b15 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs @@ -222,6 +222,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver item.Creator = m_userInfo.UserProfile.ID; item.Owner = m_userInfo.UserProfile.ID; + /* filePath = filePath.Substring(InventoryArchiveConstants.INVENTORY_PATH.Length); string[] rawFolders = filePath.Split(new char[] { '/' }); @@ -231,23 +232,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver InventoryFolderImpl foundFolder = rootDestinationFolder; while (!noFolder && i < rawFolders.Length) { - foundFolder = foundFolder.FindFolderByPath(rawFolders[i]); - if (null == foundFolder) - noFolder = true; - else + InventoryFolderImpl folder = foundFolder.FindFolderByPath(rawFolders[i]); + if (null != folder) + { + m_log.DebugFormat("[INVENTORY ARCHIVER]: Found folder {0}", folder.Name); + foundFolder = folder; i++; + } + else + { + noFolder = true; + } } // Create any folders that did not previously exist while (i < rawFolders.Length) { - foundFolder.CreateChildFolder(UUID.Random(), rawFolders[i++], (ushort)AssetType.Folder); + m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawFolders[i]); + foundFolder.CreateChildFolder(UUID.Random(), rawFolders[i++], (ushort)AssetType.Folder); } // Reset folder ID to the one in which we want to load it // TODO: Properly restore entire folder structure. At the moment all items are dumped in this // single folder no matter where in the saved folder structure they are. item.Folder = foundFolder.ID; + */ + + item.Folder = rootDestinationFolder.ID; m_userInfo.AddItem(item); successfulItemRestores++; diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index dafce81d0a..cb613f7e9a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs @@ -128,7 +128,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests bool gotObject1File = false; //bool gotObject2File = false; string expectedObject1FilePath = string.Format( - "{0}{1}_{2}.xml", + "{0}{1}{2}_{3}.xml", + InventoryArchiveConstants.INVENTORY_PATH, "Objects/", item1.Name, item1Id); @@ -151,7 +152,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests gotControlFile = true; } */ - if (filePath.StartsWith("Objects/") && filePath.EndsWith(".xml")) + if (filePath.StartsWith(InventoryArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml")) { //string fileName = filePath.Remove(0, "Objects/".Length);