diff options
author | Justin Clark-Casey (justincc) | 2013-02-16 00:49:06 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-16 00:50:52 +0000 |
commit | d54d31807af8b5e2b85897d0bb744d9d34055dff (patch) | |
tree | f26d20174d7ca1c31ee7a3b2e77754577aab1d4b /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-d54d31807af8b5e2b85897d0bb744d9d34055dff.zip opensim-SC_OLD-d54d31807af8b5e2b85897d0bb744d9d34055dff.tar.gz opensim-SC_OLD-d54d31807af8b5e2b85897d0bb744d9d34055dff.tar.bz2 opensim-SC_OLD-d54d31807af8b5e2b85897d0bb744d9d34055dff.tar.xz |
Make it so that "load iar / ..." does not save the 'root' "My Inventory" folder.
Really "My Inventory" is just the name of the root, it isn't a folder in its own right.
This also makes it more intuitive for users to save whole inventory iars for backup/later restoration, as they don't need to remember to use /*
/* will still work and this is a special case just for the root
If you want to save only the contents of other folders (rather than the folder itself), you still need to specify something like a/b/*
Added a regression test for this case.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | 55 |
2 files changed, 60 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index d703498..4ec8ae7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -272,6 +272,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
272 | saveFolderContentsOnly = true; | 272 | saveFolderContentsOnly = true; |
273 | maxComponentIndex--; | 273 | maxComponentIndex--; |
274 | } | 274 | } |
275 | else if (maxComponentIndex == -1) | ||
276 | { | ||
277 | // If the user has just specified "/", then don't save the root "My Inventory" folder. This is | ||
278 | // more intuitive then requiring the user to specify "/*" for this. | ||
279 | saveFolderContentsOnly = true; | ||
280 | } | ||
275 | 281 | ||
276 | m_invPath = String.Empty; | 282 | m_invPath = String.Empty; |
277 | for (int i = 0; i <= maxComponentIndex; i++) | 283 | for (int i = 0; i <= maxComponentIndex; i++) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 38254e5..7ff29e5 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -123,10 +123,63 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
123 | } | 123 | } |
124 | 124 | ||
125 | [Test] | 125 | [Test] |
126 | public void TestSaveRootFolderToIar() | ||
127 | { | ||
128 | TestHelpers.InMethod(); | ||
129 | // TestHelpers.EnableLogging(); | ||
130 | |||
131 | string userFirstName = "Jock"; | ||
132 | string userLastName = "Stirrup"; | ||
133 | string userPassword = "troll"; | ||
134 | UUID userId = TestHelpers.ParseTail(0x20); | ||
135 | |||
136 | UserAccountHelpers.CreateUserWithInventory(m_scene, userFirstName, userLastName, userId, userPassword); | ||
137 | |||
138 | MemoryStream archiveWriteStream = new MemoryStream(); | ||
139 | m_archiverModule.OnInventoryArchiveSaved += SaveCompleted; | ||
140 | |||
141 | mre.Reset(); | ||
142 | m_archiverModule.ArchiveInventory( | ||
143 | Guid.NewGuid(), userFirstName, userLastName, "/", userPassword, archiveWriteStream); | ||
144 | mre.WaitOne(60000, false); | ||
145 | |||
146 | // Test created iar | ||
147 | byte[] archive = archiveWriteStream.ToArray(); | ||
148 | MemoryStream archiveReadStream = new MemoryStream(archive); | ||
149 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | ||
150 | |||
151 | // InventoryArchiveUtils. | ||
152 | bool gotObjectsFolder = false; | ||
153 | |||
154 | string objectsFolderName | ||
155 | = string.Format( | ||
156 | "{0}{1}", | ||
157 | ArchiveConstants.INVENTORY_PATH, | ||
158 | InventoryArchiveWriteRequest.CreateArchiveFolderName( | ||
159 | UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, userId, "Objects"))); | ||
160 | |||
161 | string filePath; | ||
162 | TarArchiveReader.TarEntryType tarEntryType; | ||
163 | |||
164 | while (tar.ReadEntry(out filePath, out tarEntryType) != null) | ||
165 | { | ||
166 | // Console.WriteLine("Got {0}", filePath); | ||
167 | |||
168 | // Lazily, we only bother to look for the system objects folder created when we call CreateUserWithInventory() | ||
169 | // XXX: But really we need to stop all that stuff being created in tests or check for such folders | ||
170 | // more thoroughly | ||
171 | if (filePath == objectsFolderName) | ||
172 | gotObjectsFolder = true; | ||
173 | } | ||
174 | |||
175 | Assert.That(gotObjectsFolder, Is.True); | ||
176 | } | ||
177 | |||
178 | [Test] | ||
126 | public void TestSaveNonRootFolderToIar() | 179 | public void TestSaveNonRootFolderToIar() |
127 | { | 180 | { |
128 | TestHelpers.InMethod(); | 181 | TestHelpers.InMethod(); |
129 | TestHelpers.EnableLogging(); | 182 | // TestHelpers.EnableLogging(); |
130 | 183 | ||
131 | string userFirstName = "Jock"; | 184 | string userFirstName = "Jock"; |
132 | string userLastName = "Stirrup"; | 185 | string userLastName = "Stirrup"; |