From 6f689f591a295195cf8db3c37bcd382502d468d7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Sep 2010 17:56:31 +0100 Subject: Merge Master --- .../Region/ScriptEngine/Interfaces/IScriptEngine.cs | 1 + .../Region/ScriptEngine/Shared/AssemblyResolver.cs | 7 ++++--- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 5 +++-- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 21 ++++++++++++++------- 4 files changed, 22 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 02d1511..581a9a9 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs @@ -82,6 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces IConfig Config { get; } IConfigSource ConfigSource { get; } string ScriptEngineName { get; } + string ScriptEnginePath { get; } IScriptApi GetApi(UUID itemID, string name); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs index ade1924..130e197 100644 --- a/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/AssemblyResolver.cs @@ -32,7 +32,7 @@ using System.Reflection; namespace OpenSim.Region.ScriptEngine.Shared { [Serializable] - public class AssemblyResolver + public class AssemblyResolver : MarshalByRefObject { public static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) @@ -42,9 +42,10 @@ namespace OpenSim.Region.ScriptEngine.Shared AppDomain myDomain = (AppDomain)sender; string dirName = myDomain.FriendlyName; + string ScriptEnginesPath = myDomain.SetupInformation.PrivateBinPath; - string[] pathList = new string[] {"bin", "ScriptEngines", - Path.Combine("ScriptEngines", dirName)}; + string[] pathList = new string[] {"bin", ScriptEnginesPath, + Path.Combine(ScriptEnginesPath, dirName)}; string assemblyName = args.Name; if (assemblyName.IndexOf(",") != -1) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index cd8c67e..49d6abe 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -72,7 +72,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools private Dictionary LanguageMapping = new Dictionary(StringComparer.CurrentCultureIgnoreCase); private string FilePrefix; - private string ScriptEnginesPath = "ScriptEngines"; + private string ScriptEnginesPath = null; // mapping between LSL and C# line/column numbers private ICodeConverter LSL_Converter; @@ -95,7 +95,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools public Compiler(IScriptEngine scriptEngine) { - m_scriptEngine = scriptEngine; + m_scriptEngine = scriptEngine;; + ScriptEnginesPath = scriptEngine.ScriptEnginePath; ReadConfig(); } diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index e82d297..c0ec0e8 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -89,6 +89,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(); @@ -224,6 +225,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine get { return m_ScriptConfig; } } + public string ScriptEnginePath + { + get { return m_ScriptEnginesPath; } + } + public IConfigSource ConfigSource { get { return m_ConfigSource; } @@ -281,6 +287,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) @@ -478,7 +485,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine return 0; } - public Type ReplaceableInterface + public Type ReplaceableInterface { get { return null; } } @@ -1040,7 +1047,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; @@ -1186,8 +1193,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; @@ -1564,7 +1571,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)) @@ -1604,7 +1611,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 @@ -1630,7 +1637,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