diff options
Diffstat (limited to 'OpenSim/Server/Base/ServerUtils.cs')
-rw-r--r-- | OpenSim/Server/Base/ServerUtils.cs | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs index 31b0446..3f208bf 100644 --- a/OpenSim/Server/Base/ServerUtils.cs +++ b/OpenSim/Server/Base/ServerUtils.cs | |||
@@ -89,12 +89,39 @@ namespace OpenSim.Server.Base | |||
89 | Config = config; | 89 | Config = config; |
90 | 90 | ||
91 | Registry = new AddinRegistry(registryPath, "."); | 91 | Registry = new AddinRegistry(registryPath, "."); |
92 | suppress_console_output_(true); | ||
92 | AddinManager.Initialize(registryPath); | 93 | AddinManager.Initialize(registryPath); |
94 | suppress_console_output_(false); | ||
93 | AddinManager.Registry.Update(); | 95 | AddinManager.Registry.Update(); |
94 | CommandManager commandmanager = new CommandManager(Registry); | 96 | CommandManager commandmanager = new CommandManager(Registry); |
95 | AddinManager.AddExtensionNodeHandler("/Robust/Connector", OnExtensionChanged); | 97 | AddinManager.AddExtensionNodeHandler("/Robust/Connector", OnExtensionChanged); |
96 | } | 98 | } |
97 | 99 | ||
100 | private static TextWriter prev_console_; | ||
101 | // Temporarily masking the errors reported on start | ||
102 | // This is caused by a non-managed dll in the ./bin dir | ||
103 | // when the registry is initialized. The dll belongs to | ||
104 | // libomv, which has a hard-coded path to "." for pinvoke | ||
105 | // to load the openjpeg dll | ||
106 | // | ||
107 | // Will look for a way to fix, but for now this keeps the | ||
108 | // confusion to a minimum. this was copied from our region | ||
109 | // plugin loader, we have been doing this in there for a long time. | ||
110 | // | ||
111 | public void suppress_console_output_(bool save) | ||
112 | { | ||
113 | if (save) | ||
114 | { | ||
115 | prev_console_ = System.Console.Out; | ||
116 | System.Console.SetOut(new StreamWriter(Stream.Null)); | ||
117 | } | ||
118 | else | ||
119 | { | ||
120 | if (prev_console_ != null) | ||
121 | System.Console.SetOut(prev_console_); | ||
122 | } | ||
123 | } | ||
124 | |||
98 | private void OnExtensionChanged(object s, ExtensionNodeEventArgs args) | 125 | private void OnExtensionChanged(object s, ExtensionNodeEventArgs args) |
99 | { | 126 | { |
100 | IRobustConnector connector = (IRobustConnector)args.ExtensionObject; | 127 | IRobustConnector connector = (IRobustConnector)args.ExtensionObject; |
@@ -112,8 +139,7 @@ namespace OpenSim.Server.Base | |||
112 | if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) | 139 | if (a.AddinFile.Contains(Registry.DefaultAddinsFolder)) |
113 | { | 140 | { |
114 | m_log.InfoFormat("[SERVER]: Adding {0} from registry", a.Name); | 141 | m_log.InfoFormat("[SERVER]: Adding {0} from registry", a.Name); |
115 | connector.PluginPath = String.Format("{0}/{1}", Registry.DefaultAddinsFolder, a.Name.Replace(',', '.')); | 142 | connector.PluginPath = System.IO.Path.Combine(Registry.DefaultAddinsFolder,a.Name.Replace(',', '.')); } |
116 | } | ||
117 | else | 143 | else |
118 | { | 144 | { |
119 | m_log.InfoFormat("[SERVER]: Adding {0} from ./bin", a.Name); | 145 | m_log.InfoFormat("[SERVER]: Adding {0} from ./bin", a.Name); |
@@ -189,20 +215,30 @@ namespace OpenSim.Server.Base | |||
189 | /// <param name="dllName"></param> | 215 | /// <param name="dllName"></param> |
190 | /// <param name="args">The arguments which control which constructor is invoked on the plugin</param> | 216 | /// <param name="args">The arguments which control which constructor is invoked on the plugin</param> |
191 | /// <returns></returns> | 217 | /// <returns></returns> |
192 | public static T LoadPlugin<T>(string dllName, Object[] args) where T:class | 218 | public static T LoadPlugin<T> (string dllName, Object[] args) where T:class |
193 | { | 219 | { |
194 | // This is good to debug configuration problems | 220 | // This is good to debug configuration problems |
195 | //if (dllName == string.Empty) | 221 | //if (dllName == string.Empty) |
196 | // Util.PrintCallStack(); | 222 | // Util.PrintCallStack(); |
197 | 223 | ||
198 | string[] parts = dllName.Split(new char[] {':'}); | ||
199 | |||
200 | dllName = parts[0]; | ||
201 | |||
202 | string className = String.Empty; | 224 | string className = String.Empty; |
203 | 225 | ||
204 | if (parts.Length > 1) | 226 | // The path for a dynamic plugin will contain ":" on Windows |
205 | className = parts[1]; | 227 | string[] parts = dllName.Split (new char[] {':'}); |
228 | |||
229 | if (parts [0].Length > 1) | ||
230 | { | ||
231 | dllName = parts [0]; | ||
232 | if (parts.Length > 1) | ||
233 | className = parts[1]; | ||
234 | } | ||
235 | else | ||
236 | { | ||
237 | // This is Windows - we must replace the ":" in the path | ||
238 | dllName = String.Format ("{0}:{1}", parts [0], parts [1]); | ||
239 | if (parts.Length > 2) | ||
240 | className = parts[2]; | ||
241 | } | ||
206 | 242 | ||
207 | return LoadPlugin<T>(dllName, className, args); | 243 | return LoadPlugin<T>(dllName, className, args); |
208 | } | 244 | } |