From 4f25b73b572e458a3e98614fc5694286e5e3fb92 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 25 Sep 2010 16:22:18 -0400 Subject: [PATCH 1/8] 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 --- .../ScriptEngine/Interfaces/IScriptEngine.cs | 1 + .../ScriptEngine/Shared/AssemblyResolver.cs | 7 ++--- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 5 ++-- .../Region/ScriptEngine/XEngine/XEngine.cs | 27 ++++++++++++------- bin/OpenSim.ini.example | 4 +++ bin/OpenSimDefaults.ini | 5 +++- 6 files changed, 33 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 02d15118f7..581a9a9443 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 ade192475e..130e197841 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 cd8c67e601..49d6abec07 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 427d4e5b16..86296740ef 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 diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 109e0aa55e..abd4d40589 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -545,6 +545,10 @@ ;; false to allow script controlled underground positioning of ;; prims ; DisableUndergroundMovement = true + ; + ; Path to script engine assemblies + ; Default is ./bin/ScriptEngines + ; ScriptEnginesPath = "ScriptEngines" [MRM] ;; Enables the Mini Region Modules Script Engine. diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index e78f25b81f..d20a91d3e4 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -999,7 +999,10 @@ ; false to allow script controlled underground positioning of ; prims ; DisableUndergroundMovement = true - + ; + ; Path to script engine assemblies + ; Default is ./bin/ScriptEngines + ; ScriptEnginesPath = "ScriptEngines" [OpenGridProtocol] ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. From 51e03617e9c5f9f04ac555005bbd150187f13066 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Sep 2010 02:31:37 +0100 Subject: [PATCH 2/8] Changes to preceding patch to make it conform to inifile formats. BLANK LINE before each comment/option group, and DOUBLE SEMICOLONS before pure text comments in OpenSim.ini.exemaple --- bin/OpenSim.ini.example | 6 +++--- bin/OpenSimDefaults.ini | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index abd4d40589..2b78014968 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -545,9 +545,9 @@ ;; false to allow script controlled underground positioning of ;; prims ; DisableUndergroundMovement = true - ; - ; Path to script engine assemblies - ; Default is ./bin/ScriptEngines + + ;; Path to script engine assemblies + ;; Default is ./bin/ScriptEngines ; ScriptEnginesPath = "ScriptEngines" [MRM] diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index d20a91d3e4..355c546895 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -999,7 +999,7 @@ ; false to allow script controlled underground positioning of ; prims ; DisableUndergroundMovement = true - ; + ; Path to script engine assemblies ; Default is ./bin/ScriptEngines ; ScriptEnginesPath = "ScriptEngines" From 8afa21cef0d138b2a85e218875b937d48edbc5d5 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 26 Sep 2010 00:21:28 -0400 Subject: [PATCH 3/8] Some cleanup to OpenSimDefaults.ini Fixing a couple of errors --- bin/OpenSimDefaults.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 355c546895..26acac7b72 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -135,6 +135,10 @@ meshing = Meshmerizer ;meshing = ZeroMesher + + ;; Path to decoded sculpty maps + ;; Defaults to "j2kDecodeCache + ;DecodedSculpMapPath = "j2kDecodeCache" ; Choose one of the physics engines below ; OpenDynamicsEngine is by some distance the most developed physics engine @@ -999,9 +1003,14 @@ ; false to allow script controlled underground positioning of ; prims ; DisableUndergroundMovement = true +<<<<<<< HEAD:bin/OpenSimDefaults.ini ; Path to script engine assemblies ; Default is ./bin/ScriptEngines +======= + + ;; Path to script assemblies +>>>>>>> 298b4c0... Some cleanup to OpenSimDefaults.ini:OpenSim/Region/Application/OpenSimDefaults.ini ; ScriptEnginesPath = "ScriptEngines" [OpenGridProtocol] From b0b4782a2b3c7a86195ad09c1c508856c2885f4d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 25 Sep 2010 22:36:38 -0400 Subject: [PATCH 4/8] adding configurable j2kDecodeCache path allowing the decoded sculpt map cache path to be defined in the configuration files. Use DecodedSculpMapPath in the [Startup] section to set the path. The default is still ./bin/j2kDecodeCache --- .../Region/Physics/Manager/PhysicsPluginManager.cs | 4 ++-- OpenSim/Region/Physics/Manager/ZeroMesher.cs | 3 ++- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 13 +++++++++---- .../Region/Physics/OdePlugin/Tests/ODETestClass.cs | 6 +++++- bin/OpenSimDefaults.ini | 6 ------ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 7130a3e171..376369660f 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -81,7 +81,7 @@ namespace OpenSim.Region.Physics.Manager if (_MeshPlugins.ContainsKey(meshEngineName)) { m_log.Info("[PHYSICS]: creating meshing engine " + meshEngineName); - meshEngine = _MeshPlugins[meshEngineName].GetMesher(); + meshEngine = _MeshPlugins[meshEngineName].GetMesher(config); } else { @@ -234,6 +234,6 @@ namespace OpenSim.Region.Physics.Manager public interface IMeshingPlugin { string GetName(); - IMesher GetMesher(); + IMesher GetMesher(IConfigSource config); } } diff --git a/OpenSim/Region/Physics/Manager/ZeroMesher.cs b/OpenSim/Region/Physics/Manager/ZeroMesher.cs index e6e75f964b..ba19db6c18 100644 --- a/OpenSim/Region/Physics/Manager/ZeroMesher.cs +++ b/OpenSim/Region/Physics/Manager/ZeroMesher.cs @@ -28,6 +28,7 @@ using System; using OpenSim.Framework; using OpenMetaverse; +using Nini.Config; /* * This is the zero mesher. @@ -53,7 +54,7 @@ namespace OpenSim.Region.Physics.Manager return "ZeroMesher"; } - public IMesher GetMesher() + public IMesher GetMesher(IConfigSource config) { return new ZeroMesher(); } diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index fded95e4bb..62f947c1cc 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -35,6 +35,7 @@ using System.Drawing; using System.Drawing.Imaging; using PrimMesher; using log4net; +using Nini.Config; using System.Reflection; using System.IO; @@ -51,9 +52,9 @@ namespace OpenSim.Region.Physics.Meshing return "Meshmerizer"; } - public IMesher GetMesher() + public IMesher GetMesher(IConfigSource config) { - return new Meshmerizer(); + return new Meshmerizer(config); } } @@ -70,14 +71,18 @@ namespace OpenSim.Region.Physics.Meshing #endif private bool cacheSculptMaps = true; - private string decodedScultMapPath = "j2kDecodeCache"; + private string decodedScultMapPath = null; private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh private Dictionary m_uniqueMeshes = new Dictionary(); - public Meshmerizer() + public Meshmerizer(IConfigSource config) { + IConfig start_config = config.Configs["Startup"]; + + decodedScultMapPath = start_config.GetString("DecodedSculpMapPath","j2kDecodeCache"); + try { if (!Directory.Exists(decodedScultMapPath)) diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index 69e2d03482..ab8f8bf05f 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -48,6 +48,10 @@ namespace OpenSim.Region.Physics.OdePlugin [SetUp] public void Initialize() { + IConfigSource TopConfig = new IniConfigSource(); + IConfig config = TopConfig.AddConfig("Startup"); + config.Set("DecodedSculpMapPath","j2kDecodeCache"); + // Loading ODEPlugin cbt = new OdePlugin(); // Loading Zero Mesher @@ -55,7 +59,7 @@ namespace OpenSim.Region.Physics.OdePlugin // Getting Physics Scene ps = cbt.GetScene("test"); // Initializing Physics Scene. - ps.Initialise(imp.GetMesher(),null); + ps.Initialise(imp.GetMesher(TopConfig),null); float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize]; for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++) { diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 26acac7b72..4c579c9f8e 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -1003,14 +1003,8 @@ ; false to allow script controlled underground positioning of ; prims ; DisableUndergroundMovement = true -<<<<<<< HEAD:bin/OpenSimDefaults.ini - ; Path to script engine assemblies - ; Default is ./bin/ScriptEngines -======= - ;; Path to script assemblies ->>>>>>> 298b4c0... Some cleanup to OpenSimDefaults.ini:OpenSim/Region/Application/OpenSimDefaults.ini ; ScriptEnginesPath = "ScriptEngines" [OpenGridProtocol] From d0c271adc647e9e49e53988bedb0ebc962540378 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Sep 2010 18:05:55 +0100 Subject: [PATCH 5/8] Typo fixes --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 12 ++++++------ .../Region/Physics/OdePlugin/Tests/ODETestClass.cs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 62f947c1cc..20a5bb4815 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -71,7 +71,7 @@ namespace OpenSim.Region.Physics.Meshing #endif private bool cacheSculptMaps = true; - private string decodedScultMapPath = null; + private string decodedSculptMapPath = null; private float minSizeForComplexMesh = 0.2f; // prims with all dimensions smaller than this will have a bounding box mesh @@ -81,16 +81,16 @@ namespace OpenSim.Region.Physics.Meshing { IConfig start_config = config.Configs["Startup"]; - decodedScultMapPath = start_config.GetString("DecodedSculpMapPath","j2kDecodeCache"); + decodedSculptMapPath = start_config.GetString("DecodedSculptMapPath","j2kDecodeCache"); try { - if (!Directory.Exists(decodedScultMapPath)) - Directory.CreateDirectory(decodedScultMapPath); + if (!Directory.Exists(decodedSculptMapPath)) + Directory.CreateDirectory(decodedSculptMapPath); } catch (Exception e) { - m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedScultMapPath, e.Message); + m_log.WarnFormat("[SCULPT]: Unable to create {0} directory: ", decodedSculptMapPath, e.Message); } } @@ -265,7 +265,7 @@ namespace OpenSim.Region.Physics.Meshing { if (cacheSculptMaps && primShape.SculptTexture != UUID.Zero) { - decodedSculptFileName = System.IO.Path.Combine(decodedScultMapPath, "smap_" + primShape.SculptTexture.ToString()); + decodedSculptFileName = System.IO.Path.Combine(decodedSculptMapPath, "smap_" + primShape.SculptTexture.ToString()); try { if (File.Exists(decodedSculptFileName)) diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index ab8f8bf05f..a7f8baa729 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.Physics.OdePlugin { IConfigSource TopConfig = new IniConfigSource(); IConfig config = TopConfig.AddConfig("Startup"); - config.Set("DecodedSculpMapPath","j2kDecodeCache"); + config.Set("DecodedSculptMapPath","j2kDecodeCache"); // Loading ODEPlugin cbt = new OdePlugin(); From 14db53b723591642c15eb8f40290775d999d10e7 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Sep 2010 18:35:15 +0100 Subject: [PATCH 6/8] Another typo fix --- bin/OpenSimDefaults.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 4c579c9f8e..f939cc8d7f 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -138,7 +138,7 @@ ;; Path to decoded sculpty maps ;; Defaults to "j2kDecodeCache - ;DecodedSculpMapPath = "j2kDecodeCache" + ;DecodedSculptMapPath = "j2kDecodeCache" ; Choose one of the physics engines below ; OpenDynamicsEngine is by some distance the most developed physics engine From dc49057c8a1cf99590aa3df25d4888d6dea54eaa Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Sep 2010 20:03:00 +0100 Subject: [PATCH 7/8] Consistency patch: use Path.Combine() instead of + and eliminate the need for a trailing slash on exports/ --- .../CoreModules/World/Serialiser/SerialiseObjects.cs | 2 +- .../CoreModules/World/Serialiser/SerialiseTerrain.cs | 5 +++-- .../CoreModules/World/Serialiser/SerialiserModule.cs | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs index 5067ebd12b..328fbf0275 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs @@ -41,7 +41,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser public string WriteToFile(Scene scene, string dir) { - string targetFileName = dir + "objects.xml"; + string targetFileName = Path.Combine(dir, "objects.xml"); SaveSerialisedToFile(targetFileName, scene); diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs index 5cbe66bb53..c04753da73 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseTerrain.cs @@ -28,6 +28,7 @@ using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; using OpenSim.Region.Framework.Scenes; +using System.IO; namespace OpenSim.Region.CoreModules.World.Serialiser { @@ -38,7 +39,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser public string WriteToFile(Scene scene, string dir) { ITerrainLoader fileSystemExporter = new RAW32(); - string targetFileName = dir + "heightmap.r32"; + string targetFileName = Path.Combine(dir, "heightmap.r32"); lock (scene.Heightmap) { @@ -50,4 +51,4 @@ namespace OpenSim.Region.CoreModules.World.Serialiser #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs index 98fe4935bc..04062b0ec2 100644 --- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs +++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs @@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser private Commander m_commander = new Commander("export"); private List m_regions = new List(); - private string m_savedir = "exports" + "/"; + private string m_savedir = "exports"; private List m_serialisers = new List(); #region ISharedRegionModule Members @@ -192,14 +192,14 @@ namespace OpenSim.Region.CoreModules.World.Serialiser } } - TextWriter regionInfoWriter = new StreamWriter(saveDir + "README.TXT"); + TextWriter regionInfoWriter = new StreamWriter(Path.Combine(saveDir, "README.TXT")); regionInfoWriter.WriteLine("Region Name: " + scene.RegionInfo.RegionName); regionInfoWriter.WriteLine("Region ID: " + scene.RegionInfo.RegionID.ToString()); regionInfoWriter.WriteLine("Backup Time: UTC " + DateTime.UtcNow.ToString()); regionInfoWriter.WriteLine("Serialise Version: 0.1"); regionInfoWriter.Close(); - TextWriter manifestWriter = new StreamWriter(saveDir + "region.manifest"); + TextWriter manifestWriter = new StreamWriter(Path.Combine(saveDir, "region.manifest")); foreach (string line in results) { manifestWriter.WriteLine(line); @@ -231,7 +231,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser if (region.RegionInfo.RegionName == (string) args[0]) { // List results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); - SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); + SerialiseRegion(region, Path.Combine(m_savedir, region.RegionInfo.RegionID.ToString())); } } } @@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser foreach (Scene region in m_regions) { // List results = SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); - SerialiseRegion(region, m_savedir + region.RegionInfo.RegionID.ToString() + "/"); + SerialiseRegion(region, Path.Combine(m_savedir, region.RegionInfo.RegionID.ToString())); } } From 6f78358b09e5a14c4af802a12cfb805b8fc8cdb4 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 26 Sep 2010 23:50:55 +0100 Subject: [PATCH 8/8] When receiving intersim IM, don't let the spoof protection bomb --- .../CoreModules/Avatar/InstantMessage/InstantMessageModule.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index bafb802cf9..af395657dd 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs @@ -158,7 +158,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage if (m_TransferModule != null) { - im.fromAgentName = client.FirstName + " " + client.LastName; + if (client != null) + im.fromAgentName = client.FirstName + " " + client.LastName; m_TransferModule.SendInstantMessage(im, delegate(bool success) {