From c26f177cd4320f306f1b07d18032f0d42720ba09 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 9 Oct 2008 18:33:42 +0000 Subject: * Fix http://opensimulator.org/mantis/view.php?id=2368 * This returns to writing the OpenSim.ini using default values if it (or OpenSim.xml) isn't found --- OpenSim/Region/Application/OpenSimBase.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'OpenSim/Region/Application/OpenSimBase.cs') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 132e86d..b116afa 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -156,6 +156,8 @@ namespace OpenSim /// public OpenSimBase(IConfigSource configSource) : base() { + bool iniFileExists = false; + IConfig startupConfig = configSource.Configs["Startup"]; string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini"); @@ -168,6 +170,8 @@ namespace OpenSim //check for .INI file (either default or name passed in command line) if (File.Exists(Application.iniFilePath)) { + iniFileExists = true; + // From reading Nini's code, it seems that later merged keys replace earlier ones. m_config.Source.Merge(new IniConfigSource(Application.iniFilePath)); m_config.Source.Merge(configSource); @@ -179,11 +183,16 @@ namespace OpenSim if (File.Exists(Application.iniFilePath)) { + iniFileExists = true; + m_config.Source = new XmlConfigSource(); m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath)); m_config.Source.Merge(configSource); } } + + if (!iniFileExists) + m_config.Save("OpenSim.ini"); ReadConfigSettings(); } -- cgit v1.1