diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index ff583e5..3250ddf 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -206,7 +206,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
206 | /// <summary> | 206 | /// <summary> |
207 | /// Replicate the inventory paths in the archive to the user's inventory as necessary. | 207 | /// Replicate the inventory paths in the archive to the user's inventory as necessary. |
208 | /// </summary> | 208 | /// </summary> |
209 | /// <param name="fsPath"></param> | 209 | /// <param name="archivePath">The item archive path to replicate</param> |
210 | /// <param name="isDir">Is the path we're dealing with a directory?</param> | 210 | /// <param name="isDir">Is the path we're dealing with a directory?</param> |
211 | /// <param name="rootDestinationFolder">The root folder for the inventory load</param> | 211 | /// <param name="rootDestinationFolder">The root folder for the inventory load</param> |
212 | /// <param name="foldersCreated"> | 212 | /// <param name="foldersCreated"> |
@@ -218,49 +218,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
218 | /// </param> | 218 | /// </param> |
219 | /// <returns>The last user inventory folder created or found for the archive path</returns> | 219 | /// <returns>The last user inventory folder created or found for the archive path</returns> |
220 | public InventoryFolderBase ReplicateArchivePathToUserInventory( | 220 | public InventoryFolderBase ReplicateArchivePathToUserInventory( |
221 | string fsPath, | 221 | string archivePath, |
222 | bool isDir, | 222 | bool isDir, |
223 | InventoryFolderBase rootDestFolder, | 223 | InventoryFolderBase rootDestFolder, |
224 | Dictionary <string, InventoryFolderBase> foldersCreated, | 224 | Dictionary <string, InventoryFolderBase> foldersCreated, |
225 | List<InventoryNodeBase> nodesLoaded) | 225 | List<InventoryNodeBase> nodesLoaded) |
226 | { | 226 | { |
227 | fsPath = fsPath.Substring(ArchiveConstants.INVENTORY_PATH.Length); | 227 | archivePath = archivePath.Substring(ArchiveConstants.INVENTORY_PATH.Length); |
228 | 228 | ||
229 | // Remove the file portion if we aren't already dealing with a directory path | 229 | // Remove the file portion if we aren't already dealing with a directory path |
230 | if (!isDir) | 230 | if (!isDir) |
231 | fsPath = fsPath.Remove(fsPath.LastIndexOf("/") + 1); | 231 | archivePath = archivePath.Remove(archivePath.LastIndexOf("/") + 1); |
232 | 232 | ||
233 | string originalFsPath = fsPath; | 233 | string originalArchivePath = archivePath; |
234 | 234 | ||
235 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading to folder {0}", fsPath); | 235 | m_log.DebugFormat( |
236 | "[INVENTORY ARCHIVER]: Loading to folder {0 {1}}", rootDestFolder.Name, rootDestFolder.ID); | ||
236 | 237 | ||
237 | InventoryFolderBase destFolder = null; | 238 | InventoryFolderBase destFolder = null; |
238 | 239 | ||
239 | // XXX: Nasty way of dealing with a path that has no directory component | 240 | // XXX: Nasty way of dealing with a path that has no directory component |
240 | if (fsPath.Length > 0) | 241 | if (archivePath.Length > 0) |
241 | { | 242 | { |
242 | while (null == destFolder && fsPath.Length > 0) | 243 | while (null == destFolder && archivePath.Length > 0) |
243 | { | 244 | { |
244 | if (foldersCreated.ContainsKey(fsPath)) | 245 | if (foldersCreated.ContainsKey(archivePath)) |
245 | { | 246 | { |
246 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Found previously created fs path {0}", fsPath); | 247 | m_log.DebugFormat( |
247 | destFolder = foldersCreated[fsPath]; | 248 | "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath); |
249 | destFolder = foldersCreated[archivePath]; | ||
248 | } | 250 | } |
249 | else | 251 | else |
250 | { | 252 | { |
251 | // Don't include the last slash | 253 | // Don't include the last slash |
252 | int penultimateSlashIndex = fsPath.LastIndexOf("/", fsPath.Length - 2); | 254 | int penultimateSlashIndex = archivePath.LastIndexOf("/", archivePath.Length - 2); |
253 | 255 | ||
254 | if (penultimateSlashIndex >= 0) | 256 | if (penultimateSlashIndex >= 0) |
255 | { | 257 | { |
256 | fsPath = fsPath.Remove(penultimateSlashIndex + 1); | 258 | archivePath = archivePath.Remove(penultimateSlashIndex + 1); |
257 | } | 259 | } |
258 | else | 260 | else |
259 | { | 261 | { |
260 | m_log.DebugFormat( | 262 | m_log.DebugFormat( |
261 | "[INVENTORY ARCHIVER]: Found no previously created fs path for {0}", | 263 | "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}", |
262 | originalFsPath); | 264 | originalArchivePath); |
263 | fsPath = string.Empty; | 265 | archivePath = string.Empty; |
264 | destFolder = rootDestFolder; | 266 | destFolder = rootDestFolder; |
265 | } | 267 | } |
266 | } | 268 | } |
@@ -271,14 +273,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
271 | destFolder = rootDestFolder; | 273 | destFolder = rootDestFolder; |
272 | } | 274 | } |
273 | 275 | ||
274 | string fsPathSectionToCreate = originalFsPath.Substring(fsPath.Length); | 276 | string archivePathSectionToCreate = originalArchivePath.Substring(archivePath.Length); |
275 | string[] rawDirsToCreate | 277 | string[] rawDirsToCreate |
276 | = fsPathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | 278 | = archivePathSectionToCreate.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); |
277 | int i = 0; | 279 | int i = 0; |
278 | 280 | ||
279 | while (i < rawDirsToCreate.Length) | 281 | while (i < rawDirsToCreate.Length) |
280 | { | 282 | { |
281 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Creating folder {0}", rawDirsToCreate[i]); | 283 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Loading archived folder {0}", rawDirsToCreate[i]); |
282 | 284 | ||
283 | int identicalNameIdentifierIndex | 285 | int identicalNameIdentifierIndex |
284 | = rawDirsToCreate[i].LastIndexOf( | 286 | = rawDirsToCreate[i].LastIndexOf( |
@@ -305,9 +307,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
305 | // foundFolder.Name, foundFolder.ID); | 307 | // foundFolder.Name, foundFolder.ID); |
306 | 308 | ||
307 | // Record that we have now created this folder | 309 | // Record that we have now created this folder |
308 | fsPath += rawDirsToCreate[i] + "/"; | 310 | archivePath += rawDirsToCreate[i] + "/"; |
309 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Recording creation of fs path {0}", fsPath); | 311 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Loaded archive path {0}", archivePath); |
310 | foldersCreated[fsPath] = destFolder; | 312 | foldersCreated[archivePath] = destFolder; |
311 | 313 | ||
312 | if (0 == i) | 314 | if (0 == i) |
313 | nodesLoaded.Add(destFolder); | 315 | nodesLoaded.Add(destFolder); |