* This returns to writing the OpenSim.ini using default values if it (or OpenSim.xml) isn't found0.6.0-stable
parent
c101dd2bad
commit
c26f177cd4
|
@ -156,6 +156,8 @@ namespace OpenSim
|
||||||
/// <param name="configSource"></param>
|
/// <param name="configSource"></param>
|
||||||
public OpenSimBase(IConfigSource configSource) : base()
|
public OpenSimBase(IConfigSource configSource) : base()
|
||||||
{
|
{
|
||||||
|
bool iniFileExists = false;
|
||||||
|
|
||||||
IConfig startupConfig = configSource.Configs["Startup"];
|
IConfig startupConfig = configSource.Configs["Startup"];
|
||||||
|
|
||||||
string iniFileName = startupConfig.GetString("inifile", "OpenSim.ini");
|
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)
|
//check for .INI file (either default or name passed in command line)
|
||||||
if (File.Exists(Application.iniFilePath))
|
if (File.Exists(Application.iniFilePath))
|
||||||
{
|
{
|
||||||
|
iniFileExists = true;
|
||||||
|
|
||||||
// From reading Nini's code, it seems that later merged keys replace earlier ones.
|
// 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(new IniConfigSource(Application.iniFilePath));
|
||||||
m_config.Source.Merge(configSource);
|
m_config.Source.Merge(configSource);
|
||||||
|
@ -179,11 +183,16 @@ namespace OpenSim
|
||||||
|
|
||||||
if (File.Exists(Application.iniFilePath))
|
if (File.Exists(Application.iniFilePath))
|
||||||
{
|
{
|
||||||
|
iniFileExists = true;
|
||||||
|
|
||||||
m_config.Source = new XmlConfigSource();
|
m_config.Source = new XmlConfigSource();
|
||||||
m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
|
m_config.Source.Merge(new XmlConfigSource(Application.iniFilePath));
|
||||||
m_config.Source.Merge(configSource);
|
m_config.Source.Merge(configSource);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!iniFileExists)
|
||||||
|
m_config.Save("OpenSim.ini");
|
||||||
|
|
||||||
ReadConfigSettings();
|
ReadConfigSettings();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue