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