From 50dcd66896aa9d2f03193fb13ce0e74a8d88726f Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Wed, 25 Feb 2009 18:32:39 +0000
Subject: * Fix my own unit test * Disable folder iar creation code for now
 (though this wasn't actually causing the test failure)

---
 .../Archiver/InventoryArchiveReadRequest.cs         | 21 ++++++++++++++++-----
 .../Archiver/Tests/InventoryArchiverTests.cs        |  5 +++--
 2 files changed, 19 insertions(+), 7 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 2090558..b61b524 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 dafce81..cb613f7 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);
                     
-- 
cgit v1.1