diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 42ec324d43..5215b90e4a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -300,14 +300,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (Script == String.Empty) { if (File.Exists(OutFile)) - { -// m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset); return OutFile; - } throw new Exception("Cannot find script assembly and no script text present"); } + // Don't recompile if we already have it + // + if (File.Exists(OutFile) && File.Exists(OutFile+".text") && File.Exists(OutFile+".map")) + { + // TODO: Read .map file here + return OutFile; + } + enumCompileType l = DefaultCompileLanguage; if (Script.StartsWith("//c#", true, CultureInfo.InvariantCulture)) @@ -353,14 +358,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools m_positionMap = ((CSCodeGenerator) LSL_Converter).PositionMap; } - // Check this late so the map is generated on sim start - // - if (File.Exists(OutFile) && File.Exists(OutFile+".text")) - { -// m_log.DebugFormat("[Compiler] Returning existing assembly for {0}", asset); - return OutFile; - } - if (l == enumCompileType.yp) { // Its YP, convert it to C# @@ -646,6 +643,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools sfs.Write(buf, 0, buf.Length); sfs.Close(); + string posmap = String.Empty; + foreach (KeyValuePair, KeyValuePair> kvp in m_positionMap) + { + KeyValuePair k = kvp.Key; + KeyValuePair v = kvp.Value; + posmap += String.Format("{0},{1},{2},{3}\n", + k.Key, k.Value, v.Key, v.Value); + } + + buf = enc.GetBytes(posmap); + + FileStream mfs = File.Create(OutFile+".map"); + mfs.Write(buf, 0, buf.Length); + mfs.Close(); + return OutFile; }