From 038d1bf742ba4f95ca8a83b27f6fefb755485524 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 7 Feb 2012 17:44:37 +0000 Subject: Add a regression test to compile and start a script. Remove Path.GetDirectoryName when getting assembly loading path in Compiler.CompileFromDotNetText(). The Path.GetDirectoryName call in Compiler.CompileFromDotNetText is unnecessary since AppDomain.CurrentDomain.BaseDirectory is always a directory. Later path concatenation is already done by Path.Combine() which handles any trailing slash. Removing Path.GetDirectoryName() will not affect the runtime but allows NUnit to work since it doesn't add a trailing slash to AppDomain.CurrentDomain.BaseDirectory. --- OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 734d4d5..c10143b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -291,6 +291,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools public void PerformScriptCompile(string Script, string asset, UUID ownerUUID, out string assembly, out Dictionary, KeyValuePair> linemap) { +// m_log.DebugFormat("[Compiler]: Compiling script\n{0}", Script); + linemap = null; m_warnings.Clear(); @@ -357,6 +359,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (Script.StartsWith("//yp", true, CultureInfo.InvariantCulture)) language = enumCompileType.yp; +// m_log.DebugFormat("[Compiler]: Compile language is {0}", language); + if (!AllowedCompilers.ContainsKey(language.ToString())) { // Not allowed to compile to this language! @@ -417,7 +421,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } assembly = CompileFromDotNetText(compileScript, language, asset, assembly); - return; } public string[] GetWarnings() @@ -491,6 +494,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools /// Filename to .dll assembly internal string CompileFromDotNetText(string Script, enumCompileType lang, string asset, string assembly) { +// m_log.DebugFormat("[Compiler]: Compiling to assembly\n{0}", Script); + string ext = "." + lang.ToString(); // Output assembly name @@ -531,8 +536,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools parameters.IncludeDebugInformation = true; - string rootPath = - Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory); + string rootPath = AppDomain.CurrentDomain.BaseDirectory; parameters.ReferencedAssemblies.Add(Path.Combine(rootPath, "OpenSim.Region.ScriptEngine.Shared.dll")); -- cgit v1.1