Allow Tools.Configger to take -inifile as argument

bullet-2.82
Diva Canto 2014-05-07 16:59:11 -07:00
parent 13b2ac1425
commit 3db9b847bf
2 changed files with 9 additions and 8 deletions

View File

@ -64,14 +64,14 @@ namespace OpenSim.Tools.Configger
/// <param name="configSettings"></param> /// <param name="configSettings"></param>
/// <param name="networkInfo"></param> /// <param name="networkInfo"></param>
/// <returns>A configuration that gets passed to modules</returns> /// <returns>A configuration that gets passed to modules</returns>
public IConfigSource LoadConfigSettings() public IConfigSource LoadConfigSettings(IConfig startupConfig)
{ {
bool iniFileExists = false; bool iniFileExists = false;
List<string> sources = new List<string>(); List<string> sources = new List<string>();
string iniFileName = "OpenSim.ini"; string iniFileName = startupConfig.GetString("inifile", Path.Combine(".", "OpenSim.ini"));
string iniFilePath = Path.Combine(".", iniFileName); Console.WriteLine("---> " + iniFileName + " <---");
if (IsUri(iniFileName)) if (IsUri(iniFileName))
{ {
@ -80,10 +80,10 @@ namespace OpenSim.Tools.Configger
} }
else else
{ {
if (File.Exists(iniFilePath)) if (File.Exists(iniFileName))
{ {
if (!sources.Contains(iniFilePath)) if (!sources.Contains(iniFileName))
sources.Add(iniFilePath); sources.Add(iniFileName);
} }
} }

View File

@ -35,15 +35,16 @@ namespace OpenSim.Tools.Configger
public static int Main(string[] args) public static int Main(string[] args)
{ {
ArgvConfigSource argvConfig = new ArgvConfigSource(args); ArgvConfigSource argvConfig = new ArgvConfigSource(args);
argvConfig.AddSwitch("Startup", "format", "f"); argvConfig.AddSwitch("Startup", "format", "f");
argvConfig.AddSwitch("Startup", "inifile");
IConfig startupConfig = argvConfig.Configs["Startup"]; IConfig startupConfig = argvConfig.Configs["Startup"];
string format = startupConfig.GetString("format", "ini"); string format = startupConfig.GetString("format", "ini");
ConfigurationLoader loader = new ConfigurationLoader(); ConfigurationLoader loader = new ConfigurationLoader();
IConfigSource s = loader.LoadConfigSettings(startupConfig);
IConfigSource s = loader.LoadConfigSettings();
if (format == "mysql") if (format == "mysql")
{ {