From a62b906a7b77340c61c4d3b084c3d950cf5172ba Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 31 Jul 2008 17:32:13 +0000 Subject: * allow inventory folders to be located by path * first pass method impl --- OpenSim/Region/Application/OpenSimBase.cs | 43 +++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 2b3ffd8..0d471d8 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -680,7 +680,7 @@ namespace OpenSim string firstName = cmdparams[0]; string lastName = cmdparams[1]; - //string invPath = cmdparams[2]; + string invPath = cmdparams[2]; //string savePath = (cmdparams.Length > 3 ? cmdparams[3] : DEFAULT_INV_BACKUP_FILENAME); UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(firstName, lastName); @@ -695,7 +695,46 @@ namespace OpenSim { m_log.ErrorFormat("[CONSOLE]: Failed to find user info for {0} {1} {2}", firstName, lastName, userProfile.ID); return; - } + } + + InventoryFolderImpl inventoryFolder = null; + + if (userInfo.HasReceivedInventory) + { + if (invPath == InventoryFolderImpl.PATH_DELIMITER) + { + inventoryFolder = userInfo.RootFolder; + } + else + { + // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl + // itself (possibly at a small loss in efficiency). + string[] components + = invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); + invPath = String.Empty; + foreach (string c in components) + { + invPath += c + InventoryFolderImpl.PATH_DELIMITER; + } + + inventoryFolder = userInfo.RootFolder.FindFolderByPath(invPath); + } + } + else + { + m_log.ErrorFormat("[CONSOLE]: Have not yet received inventory info for user {0} {1} {2}", firstName, lastName, userProfile.ID); + return; + } + + if (null == inventoryFolder) + { + m_log.ErrorFormat("[CONSOLE]: Could not find folder with path {0}", invPath); + return; + } + else + { + m_log.InfoFormat("[CONSOLE]: Found folder {0} {1} at {2}", inventoryFolder.Name, inventoryFolder.ID, invPath); + } } /// -- cgit v1.1