From 405db6d450bce77bbf43ada664920189ce7bfb7a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 10 Jul 2014 19:40:44 +0100 Subject: [PATCH] refactor: use existing Compiler.CreateScriptsDirectory() (renamed to CheckOrCreateScriptsDirectory()) when checking that scripts directory exists on compile. Code was identical apart from error logging, but if there are failures creating these directories then you'll be seeing lots of errors anyway, and these will be more informative --- .../ScriptEngine/Shared/CodeTools/Compiler.cs | 30 +++---------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index 5988539ada..f874de2a5e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools if (in_startup) { in_startup = false; - CreateScriptsDirectory(); + CheckOrCreateScriptsDirectory(); // First time we start? Delete old files if (DeleteScriptsOnStartup) @@ -189,13 +189,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools } // We now have an allow-list, a mapping list, and a default language - } /// - /// Create the directory where compiled scripts are stored. + /// Create the directory where compiled scripts are stored if it does not already exist. /// - private void CreateScriptsDirectory() + private void CheckOrCreateScriptsDirectory() { if (!Directory.Exists(ScriptEnginesPath)) { @@ -302,28 +301,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools assembly = GetCompilerOutput(asset); - if (!Directory.Exists(ScriptEnginesPath)) - { - try - { - Directory.CreateDirectory(ScriptEnginesPath); - } - catch (Exception) - { - } - } - - if (!Directory.Exists(Path.Combine(ScriptEnginesPath, - m_scriptEngine.World.RegionInfo.RegionID.ToString()))) - { - try - { - Directory.CreateDirectory(ScriptEnginesPath); - } - catch (Exception) - { - } - } + CheckOrCreateScriptsDirectory(); // Don't recompile if we already have it // Performing 3 file exists tests for every script can still be slow