diff options
author | Oren Hurvitz | 2011-06-21 12:43:44 +0300 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-06-24 22:07:20 +0100 |
commit | 0dd3281caf09090e86036d67a34939b0e31c1b16 (patch) | |
tree | 0fa42c81e69bef40bfb1e121e2b954f7c4a33144 | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-0dd3281caf09090e86036d67a34939b0e31c1b16.zip opensim-SC_OLD-0dd3281caf09090e86036d67a34939b0e31c1b16.tar.gz opensim-SC_OLD-0dd3281caf09090e86036d67a34939b0e31c1b16.tar.bz2 opensim-SC_OLD-0dd3281caf09090e86036d67a34939b0e31c1b16.tar.xz |
Optionally, don't delete previously compiled scripts on startup
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | 19 | ||||
-rw-r--r-- | 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 | |||
106 | // Get some config | 106 | // Get some config |
107 | WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false); | 107 | WriteScriptSourceToDebugFile = m_scriptEngine.Config.GetBoolean("WriteScriptSourceToDebugFile", false); |
108 | CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true); | 108 | CompileWithDebugInformation = m_scriptEngine.Config.GetBoolean("CompileWithDebugInformation", true); |
109 | bool DeleteScriptsOnStartup = m_scriptEngine.Config.GetBoolean("DeleteScriptsOnStartup", true); | ||
109 | 110 | ||
110 | // Get file prefix from scriptengine name and make it file system safe: | 111 | // Get file prefix from scriptengine name and make it file system safe: |
111 | FilePrefix = "CommonCompiler"; | 112 | FilePrefix = "CommonCompiler"; |
@@ -114,11 +115,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
114 | FilePrefix = FilePrefix.Replace(c, '_'); | 115 | FilePrefix = FilePrefix.Replace(c, '_'); |
115 | } | 116 | } |
116 | 117 | ||
117 | // First time we start? Delete old files | ||
118 | if (in_startup) | 118 | if (in_startup) |
119 | { | 119 | { |
120 | in_startup = false; | 120 | in_startup = false; |
121 | DeleteOldFiles(); | 121 | CreateScriptsDirectory(); |
122 | |||
123 | // First time we start? Delete old files | ||
124 | if (DeleteScriptsOnStartup) | ||
125 | DeleteOldFiles(); | ||
122 | } | 126 | } |
123 | 127 | ||
124 | // Map name and enum type of our supported languages | 128 | // Map name and enum type of our supported languages |
@@ -187,11 +191,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
187 | } | 191 | } |
188 | 192 | ||
189 | /// <summary> | 193 | /// <summary> |
190 | /// Delete old script files | 194 | /// Create the directory where compiled scripts are stored. |
191 | /// </summary> | 195 | /// </summary> |
192 | private void DeleteOldFiles() | 196 | private void CreateScriptsDirectory() |
193 | { | 197 | { |
194 | // CREATE FOLDER IF IT DOESNT EXIST | ||
195 | if (!Directory.Exists(ScriptEnginesPath)) | 198 | if (!Directory.Exists(ScriptEnginesPath)) |
196 | { | 199 | { |
197 | try | 200 | try |
@@ -218,7 +221,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
218 | m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString()); | 221 | m_scriptEngine.World.RegionInfo.RegionID.ToString()) + "\": " + ex.ToString()); |
219 | } | 222 | } |
220 | } | 223 | } |
224 | } | ||
221 | 225 | ||
226 | /// <summary> | ||
227 | /// Delete old script files | ||
228 | /// </summary> | ||
229 | private void DeleteOldFiles() | ||
230 | { | ||
222 | foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, | 231 | foreach (string file in Directory.GetFiles(Path.Combine(ScriptEnginesPath, |
223 | m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*")) | 232 | m_scriptEngine.World.RegionInfo.RegionID.ToString()), FilePrefix + "_compiled*")) |
224 | { | 233 | { |
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 @@ | |||
1124 | ;; Path to script assemblies | 1124 | ;; Path to script assemblies |
1125 | ; ScriptEnginesPath = "ScriptEngines" | 1125 | ; ScriptEnginesPath = "ScriptEngines" |
1126 | 1126 | ||
1127 | ; Whether to delete previously compiled scripts when the sim starts. If you disable this | ||
1128 | ; then startup will be faster. However, then it becomes your responsibility to delete the | ||
1129 | ; compiled scripts if OpenSim has changed enough that previously compiled scripts are no | ||
1130 | ; longer compatible. | ||
1131 | DeleteScriptsOnStartup = true | ||
1132 | |||
1127 | 1133 | ||
1128 | [OpenGridProtocol] | 1134 | [OpenGridProtocol] |
1129 | ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. | 1135 | ;These are the settings for the Open Grid Protocol.. the Agent Domain, Region Domain, you know.. |