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 ++++++++++++++-----
bin/OpenSimDefaults.ini | 6 ++++++
2 files changed, 20 insertions(+), 5 deletions(-)
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*"))
{
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini
index 7321cad..db4836a 100644
--- a/bin/OpenSimDefaults.ini
+++ b/bin/OpenSimDefaults.ini
@@ -1124,6 +1124,12 @@
;; Path to script assemblies
; ScriptEnginesPath = "ScriptEngines"
+ ; Whether to delete previously compiled scripts when the sim starts. If you disable this
+ ; then startup will be faster. However, then it becomes your responsibility to delete the
+ ; compiled scripts if OpenSim has changed enough that previously compiled scripts are no
+ ; longer compatible.
+ DeleteScriptsOnStartup = true
+
[OpenGridProtocol]
;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know..
--
cgit v1.1