From 7d53c736f6f41c236dc8b4cb23b9fbdccce80922 Mon Sep 17 00:00:00 2001
From: Sean Dague
Date: Fri, 14 Dec 2007 17:51:18 +0000
Subject: start to pull in config for OpenSim export
---
OpenSim/Tools/Export/OpenSimExport.cs | 55 ++++++++++++++++++++++++++++++++++-
prebuild.xml | 1 +
2 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/OpenSim/Tools/Export/OpenSimExport.cs b/OpenSim/Tools/Export/OpenSimExport.cs
index e5146a3..cdafbdb 100644
--- a/OpenSim/Tools/Export/OpenSimExport.cs
+++ b/OpenSim/Tools/Export/OpenSimExport.cs
@@ -26,18 +26,71 @@
*
*/
using System;
+using System.IO;
using Nini.Config;
+using OpenSim;
using OpenSim.Framework;
using OpenSim.Framework.Console;
+using Mono.Addins;
+using Mono.Addins.Description;
namespace OpenSim.Tools.Export
{
public class OpenSimExport
{
+ private IniConfigSource config;
+
+ public OpenSimExport(IniConfigSource config)
+ {
+ this.config = config;
+ }
+
public static void Main(string[] args)
{
- ArgvConfigSource configSource = new ArgvConfigSource(args);
+ OpenSimExport export = new OpenSimExport(InitConfig(args));
+
System.Console.WriteLine("This application does nothing useful yet");
}
+
+ private static IniConfigSource InitConfig(string[] args)
+ {
+ System.Console.WriteLine("Good");
+ ArgvConfigSource configSource = new ArgvConfigSource(args);
+ configSource.AddSwitch("Startup", "inifile");
+
+// AddinManager.Initialize(".");
+// AddinManager.Registry.Update(null);
+
+ IConfig startupConfig = configSource.Configs["Startup"];
+ string iniFilePath = startupConfig.GetString("inifile", "OpenSim.ini");
+
+ IniConfigSource config = new IniConfigSource();
+ //check for .INI file (either default or name passed in command line)
+ if (File.Exists(iniFilePath))
+ {
+ config.Merge(new IniConfigSource(iniFilePath));
+ config.Merge(configSource);
+ }
+ else
+ {
+ iniFilePath = Path.Combine(Util.configDir(), iniFilePath);
+ if (File.Exists(iniFilePath))
+ {
+ config.Merge(new IniConfigSource(iniFilePath));
+ config.Merge(configSource);
+ }
+ else
+ {
+ // no default config files, so set default values, and save it
+ // SetDefaultConfig();
+ config.Merge(OpenSim.OpenSimMain.DefaultConfig());
+ config.Merge(configSource);
+ }
+ }
+
+ // ReadConfigSettings();
+
+ return config;
+ }
}
}
\ No newline at end of file
diff --git a/prebuild.xml b/prebuild.xml
index 9c376f3..7a6317c 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1177,6 +1177,7 @@
+
--
cgit v1.1