From 4f25b73b572e458a3e98614fc5694286e5e3fb92 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 25 Sep 2010 16:22:18 -0400 Subject: Add configurable path to script engine assemblies Adding ability to place script engine assemblies outside the codebase directories. Uses new [XEngine] option: ScriptEnginesPath = "path_to_assemblies" Signed-off-by: Melanie --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs') diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 427d4e5..8629674 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -88,6 +88,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine private IXmlRpcRouter m_XmlRpcRouter; private int m_EventLimit; private bool m_KillTimedOutScripts; + private string m_ScriptEnginesPath = null; private static List m_ScriptEngines = new List(); @@ -156,6 +157,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine get { return m_ScriptConfig; } } + public string ScriptEnginePath + { + get { return m_ScriptEnginesPath; } + } + public IConfigSource ConfigSource { get { return m_ConfigSource; } @@ -213,6 +219,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_EventLimit = m_ScriptConfig.GetInt("EventLimit", 30); m_KillTimedOutScripts = m_ScriptConfig.GetBoolean("KillTimedOutScripts", false); m_SaveTime = m_ScriptConfig.GetInt("SaveInterval", 120) * 1000; + m_ScriptEnginesPath = m_ScriptConfig.GetString("ScriptEnginesPath", "ScriptEngines"); m_Prio = ThreadPriority.BelowNormal; switch (priority) @@ -410,7 +417,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine return 0; } - public Type ReplaceableInterface + public Type ReplaceableInterface { get { return null; } } @@ -719,9 +726,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine try { AppDomainSetup appSetup = new AppDomainSetup(); -// appSetup.ApplicationBase = Path.Combine( -// "ScriptEngines", -// m_Scene.RegionInfo.RegionID.ToString()); + appSetup.PrivateBinPath = Path.Combine( + m_ScriptEnginesPath, + m_Scene.RegionInfo.RegionID.ToString()); Evidence baseEvidence = AppDomain.CurrentDomain.Evidence; Evidence evidence = new Evidence(baseEvidence); @@ -965,7 +972,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini startInfo.MaxWorkerThreads = maxThreads; startInfo.MinWorkerThreads = minThreads; - startInfo.ThreadPriority = threadPriority; + startInfo.ThreadPriority = threadPriority;; startInfo.StackSize = stackSize; startInfo.StartSuspended = true; @@ -1110,8 +1117,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (!(sender is System.AppDomain)) return null; - string[] pathList = new string[] {"bin", "ScriptEngines", - Path.Combine("ScriptEngines", + string[] pathList = new string[] {"bin", m_ScriptEnginesPath, + Path.Combine(m_ScriptEnginesPath, m_Scene.RegionInfo.RegionID.ToString())}; string assemblyName = args.Name; @@ -1485,7 +1492,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine string fn = assemE.GetAttribute("Filename"); string base64 = assemE.InnerText; - string path = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); + string path = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString()); path = Path.Combine(path, fn); if (!File.Exists(path)) @@ -1525,7 +1532,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine } } - string statepath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); + string statepath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString()); statepath = Path.Combine(statepath, itemID.ToString() + ".state"); try @@ -1551,7 +1558,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine { XmlElement mapE = (XmlElement)mapL[0]; - string mappath = Path.Combine("ScriptEngines", World.RegionInfo.RegionID.ToString()); + string mappath = Path.Combine(m_ScriptEnginesPath, World.RegionInfo.RegionID.ToString()); mappath = Path.Combine(mappath, mapE.GetAttribute("Filename")); try -- cgit v1.1