From 0dd3281caf09090e86036d67a34939b0e31c1b16 Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Tue, 21 Jun 2011 12:43:44 +0300 Subject: Optionally, don't delete previously compiled scripts on startup --- .../Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 49d6abe..734d4d5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -106,6 +106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools // Get some config WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false); CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true); + bool DeleteScriptsOnStartup = m_scriptEngine.Config.GetBoolean("DeleteScriptsOnStartup", true); // Get file prefix from scriptengine name and make it file system safe: FilePrefix = "CommonCompiler"; @@ -114,11 +115,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools FilePrefix = FilePrefix.Replace(c, '_'); } - // First time we start? Delete old files if (in_startup) { in_startup = false; - DeleteOldFiles(); + CreateScriptsDirectory(); + + // First time we start? Delete old files + if (DeleteScriptsOnStartup) + DeleteOldFiles(); } // Map name and enum type of our supported languages @@ -187,11 +191,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } /// - /// Delete old script files + /// Create the directory where compiled scripts are stored. /// - private void DeleteOldFiles() + private void CreateScriptsDirectory() { - // CREATE FOLDER IF IT DOESNT EXIST if (!Directory.Exists(ScriptEnginesPath)) { try @@ -218,7 +221,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString()); } } + } + /// + /// Delete old script files + /// + private void DeleteOldFiles() + { foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*")) { -- cgit v1.1