diff options
author | Justin Clark-Casey (justincc) | 2010-06-30 00:10:44 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-06-30 00:10:44 +0100 |
commit | 5925aac859ee493fd7f6b10026c84a6a22626c79 (patch) | |
tree | f7584dad5efc48c29ab51ef433a014900df98a29 /OpenSim/Framework/Serialization/ArchiveConstants.cs | |
parent | Revert "stop exceptions in setting and getting state from propogating since t... (diff) | |
download | opensim-SC_OLD-5925aac859ee493fd7f6b10026c84a6a22626c79.zip opensim-SC_OLD-5925aac859ee493fd7f6b10026c84a6a22626c79.tar.gz opensim-SC_OLD-5925aac859ee493fd7f6b10026c84a6a22626c79.tar.bz2 opensim-SC_OLD-5925aac859ee493fd7f6b10026c84a6a22626c79.tar.xz |
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
Diffstat (limited to 'OpenSim/Framework/Serialization/ArchiveConstants.cs')
-rw-r--r-- | OpenSim/Framework/Serialization/ArchiveConstants.cs | 29 |
1 files changed, 27 insertions, 2 deletions
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 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | ||
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | 32 | ||
32 | namespace OpenSim.Framework.Serialization | 33 | namespace OpenSim.Framework.Serialization |
@@ -171,6 +172,30 @@ namespace OpenSim.Framework.Serialization | |||
171 | public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) | 172 | public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) |
172 | { | 173 | { |
173 | return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); | 174 | return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); |
174 | } | 175 | } |
176 | |||
177 | /// <summary> | ||
178 | /// Extract a plain path from an IAR path | ||
179 | /// </summary> | ||
180 | /// <param name="iarPath"></param> | ||
181 | /// <returns></returns> | ||
182 | public static string ExtractPlainPathFromIarPath(string iarPath) | ||
183 | { | ||
184 | List<string> plainDirs = new List<string>(); | ||
185 | |||
186 | string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); | ||
187 | |||
188 | foreach (string iarDir in iarDirs) | ||
189 | { | ||
190 | if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) | ||
191 | plainDirs.Add(iarDir); | ||
192 | |||
193 | int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); | ||
194 | |||
195 | plainDirs.Add(iarDir.Remove(i)); | ||
196 | } | ||
197 | |||
198 | return string.Join("/", plainDirs.ToArray()); | ||
199 | } | ||
175 | } | 200 | } |
176 | } | 201 | } \ No newline at end of file |