From 5925aac859ee493fd7f6b10026c84a6a22626c79 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 30 Jun 2010 00:10:44 +0100
Subject: Add --merge switch to load iar.
When this switch is used, iar folders are merged with existing same-name user inventory folders.
This makes it a little easier to back and restore entire individual user inventories, among other things
Added unit test to check behaviour
---
.../Framework/Serialization/ArchiveConstants.cs | 29 ++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 475a9de..3143e3b 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using System.Text;
using OpenMetaverse;
namespace OpenSim.Framework.Serialization
@@ -171,6 +172,30 @@ namespace OpenSim.Framework.Serialization
public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
{
return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
- }
+ }
+
+ ///
+ /// Extract a plain path from an IAR path
+ ///
+ ///
+ ///
+ public static string ExtractPlainPathFromIarPath(string iarPath)
+ {
+ List plainDirs = new List();
+
+ string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
+
+ foreach (string iarDir in iarDirs)
+ {
+ if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
+ plainDirs.Add(iarDir);
+
+ int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
+
+ plainDirs.Add(iarDir.Remove(i));
+ }
+
+ return string.Join("/", plainDirs.ToArray());
+ }
}
-}
+}
\ No newline at end of file
--
cgit v1.1