aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-06-18 16:33:34 +0100
committerJustin Clark-Casey (justincc)2010-06-18 16:33:34 +0100
commitcf4721a92d3b0f9f3660406eca91ef76b230682a (patch)
tree627c267c6aedf46835fe48c226647451f9245c02 /OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
parentRevert "Set command timeout to infinity on migrations" (diff)
downloadopensim-SC_OLD-cf4721a92d3b0f9f3660406eca91ef76b230682a.zip
opensim-SC_OLD-cf4721a92d3b0f9f3660406eca91ef76b230682a.tar.gz
opensim-SC_OLD-cf4721a92d3b0f9f3660406eca91ef76b230682a.tar.bz2
opensim-SC_OLD-cf4721a92d3b0f9f3660406eca91ef76b230682a.tar.xz
in IAR utils, return all folders that match a particular path rather than just the first one
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs35
1 files changed, 20 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index 47b18d8..ca33968 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -55,8 +55,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
55 /// 55 ///
56 /// This method does not handle paths that contain multiple delimitors 56 /// This method does not handle paths that contain multiple delimitors
57 /// 57 ///
58 /// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some 58 /// FIXME: We have no way of distinguishing folders with the same path
59 /// XPath like expression
60 /// 59 ///
61 /// FIXME: Delimitors which occur in names themselves are not currently escapable. 60 /// FIXME: Delimitors which occur in names themselves are not currently escapable.
62 /// 61 ///
@@ -70,14 +69,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
70 /// The path to the required folder. 69 /// The path to the required folder.
71 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. 70 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
72 /// </param> 71 /// </param>
73 /// <returns>null if the folder is not found</returns> 72 /// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
74 public static InventoryFolderBase FindFolderByPath( 73 public static List<InventoryFolderBase> FindFolderByPath(
75 IInventoryService inventoryService, UUID userId, string path) 74 IInventoryService inventoryService, UUID userId, string path)
76 { 75 {
77 InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId); 76 InventoryFolderBase rootFolder = inventoryService.GetRootFolder(userId);
78 77
79 if (null == rootFolder) 78 if (null == rootFolder)
80 return null; 79 return new List<InventoryFolderBase>();
81 80
82 return FindFolderByPath(inventoryService, rootFolder, path); 81 return FindFolderByPath(inventoryService, rootFolder, path);
83 } 82 }
@@ -88,8 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
88 /// 87 ///
89 /// This method does not handle paths that contain multiple delimitors 88 /// This method does not handle paths that contain multiple delimitors
90 /// 89 ///
91 /// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some 90 /// FIXME: We have no way of distinguishing folders with the same path.
92 /// XPath like expression
93 /// 91 ///
94 /// FIXME: Delimitors which occur in names themselves are not currently escapable. 92 /// FIXME: Delimitors which occur in names themselves are not currently escapable.
95 /// 93 ///
@@ -103,17 +101,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
103 /// The path to the required folder. 101 /// The path to the required folder.
104 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned. 102 /// It this is empty or consists only of the PATH_DELIMTER then this folder itself is returned.
105 /// </param> 103 /// </param>
106 /// <returns>null if the folder is not found</returns> 104 /// <returns>An empty list if the folder is not found, otherwise a list of all folders that match the name</returns>
107 public static InventoryFolderBase FindFolderByPath( 105 public static List<InventoryFolderBase> FindFolderByPath(
108 IInventoryService inventoryService, InventoryFolderBase startFolder, string path) 106 IInventoryService inventoryService, InventoryFolderBase startFolder, string path)
109 { 107 {
108 List<InventoryFolderBase> foundFolders = new List<InventoryFolderBase>();
109
110 if (path == string.Empty) 110 if (path == string.Empty)
111 return startFolder; 111 {
112 foundFolders.Add(startFolder);
113 return foundFolders;
114 }
112 115
113 path = path.Trim(); 116 path = path.Trim();
114 117
115 if (path == PATH_DELIMITER.ToString()) 118 if (path == PATH_DELIMITER.ToString())
116 return startFolder; 119 {
120 foundFolders.Add(startFolder);
121 return foundFolders;
122 }
117 123
118 string[] components = SplitEscapedPath(path); 124 string[] components = SplitEscapedPath(path);
119 components[0] = UnescapePath(components[0]); 125 components[0] = UnescapePath(components[0]);
@@ -127,14 +133,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
127 if (folder.Name == components[0]) 133 if (folder.Name == components[0])
128 { 134 {
129 if (components.Length > 1) 135 if (components.Length > 1)
130 return FindFolderByPath(inventoryService, folder, components[1]); 136 foundFolders.AddRange(FindFolderByPath(inventoryService, folder, components[1]));
131 else 137 else
132 return folder; 138 foundFolders.Add(folder);
133 } 139 }
134 } 140 }
135 141
136 // We didn't find a folder with the right name 142 return foundFolders;
137 return null;
138 } 143 }
139 144
140 /// <summary> 145 /// <summary>