diff options
author | Teravus Ovares (Dan Olivares) | 2010-05-15 23:21:36 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2010-05-15 23:21:36 -0400 |
commit | dc1a3e9787d15f98e815b10935481606edc38f3f (patch) | |
tree | f06ed56a030973623bdc4da2dc67ab7b9a187f2a /OpenSim/Region/Application | |
parent | delete now unused MessageServerInfo (diff) | |
download | opensim-SC_OLD-dc1a3e9787d15f98e815b10935481606edc38f3f.zip opensim-SC_OLD-dc1a3e9787d15f98e815b10935481606edc38f3f.tar.gz opensim-SC_OLD-dc1a3e9787d15f98e815b10935481606edc38f3f.tar.bz2 opensim-SC_OLD-dc1a3e9787d15f98e815b10935481606edc38f3f.tar.xz |
* Add User Friendly Configuration File Exists check. If OpenSim.ini and either StandaloneCommon.ini or GridCommon.ini don't exist in various casings then offer to copy the files for the user while warning them that they're missing out if they don't read the files.
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/Application.cs | 116 |
1 files changed, 115 insertions, 1 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 7721cdf..951d66f 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -105,7 +105,7 @@ namespace OpenSim | |||
105 | 105 | ||
106 | // Check if the system is compatible with OpenSimulator. | 106 | // Check if the system is compatible with OpenSimulator. |
107 | // Ensures that the minimum system requirements are met | 107 | // Ensures that the minimum system requirements are met |
108 | m_log.Info("Performing compatibility checks... "); | 108 | m_log.Info("Performing compatibility checks... \n"); |
109 | string supported = String.Empty; | 109 | string supported = String.Empty; |
110 | if (Util.IsEnvironmentSupported(ref supported)) | 110 | if (Util.IsEnvironmentSupported(ref supported)) |
111 | { | 111 | { |
@@ -120,6 +120,112 @@ namespace OpenSim | |||
120 | Culture.SetCurrentCulture(); | 120 | Culture.SetCurrentCulture(); |
121 | 121 | ||
122 | 122 | ||
123 | // Validate that the user has the most basic configuration done | ||
124 | // If not, offer to do the most basic configuration for them warning them along the way of the importance of | ||
125 | // reading these files. | ||
126 | m_log.Info("Checking for reguired configuration...\n"); | ||
127 | |||
128 | bool OpenSim_Ini = (File.Exists(Path.Combine(Util.configDir(), "OpenSim.ini"))) | ||
129 | || (File.Exists(Path.Combine(Util.configDir(), "opensim.ini"))) | ||
130 | || (File.Exists(Path.Combine(Util.configDir(), "openSim.ini"))) | ||
131 | || (File.Exists(Path.Combine(Util.configDir(), "Opensim.ini"))); | ||
132 | |||
133 | bool StanaloneCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini")); | ||
134 | bool StanaloneCommon_lowercased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "standalonecommon.ini")); | ||
135 | bool GridCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "GridCommon.ini")); | ||
136 | bool GridCommon_lowerCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "gridcommon.ini")); | ||
137 | |||
138 | if ((OpenSim_Ini) | ||
139 | && ( | ||
140 | (StanaloneCommon_ProperCased | ||
141 | || StanaloneCommon_lowercased | ||
142 | || GridCommon_ProperCased | ||
143 | || GridCommon_lowerCased | ||
144 | ))) | ||
145 | { | ||
146 | m_log.Info("Required Configuration Files Found\n"); | ||
147 | } | ||
148 | else | ||
149 | { | ||
150 | MainConsole.Instance = new LocalConsole("Region"); | ||
151 | string resp = MainConsole.Instance.CmdPrompt( | ||
152 | "\n\n*************Required Configuration files not found.*************\n\n OpenSimulator will not run without these files.\n\nRemember, these file names are Case Sensitive in Linux and Proper Cased.\n1. ./OpenSim.ini\nand\n2. ./config-include/StandaloneCommon.ini \nor\n3. ./config-include/GridCommon.ini\n\nAlso, you will want to examine these files in great detail because only the basic system will load by default. OpenSimulator can do a LOT more if you spend a little time going through these files.\n\n" + ": " + "Do you want to copy the most basic Defaults from standalone?", | ||
153 | "yes"); | ||
154 | if (resp == "yes") | ||
155 | { | ||
156 | |||
157 | if (!(OpenSim_Ini)) | ||
158 | { | ||
159 | try | ||
160 | { | ||
161 | File.Copy(Path.Combine(Util.configDir(), "OpenSim.ini.example"), | ||
162 | Path.Combine(Util.configDir(), "OpenSim.ini")); | ||
163 | } catch (UnauthorizedAccessException) | ||
164 | { | ||
165 | MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, Make sure OpenSim has have the required permissions\n"); | ||
166 | } catch (ArgumentException) | ||
167 | { | ||
168 | MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, The current directory is invalid.\n"); | ||
169 | } catch (System.IO.PathTooLongException) | ||
170 | { | ||
171 | MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the Path to these files is too long.\n"); | ||
172 | } catch (System.IO.DirectoryNotFoundException) | ||
173 | { | ||
174 | MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the current directory is reporting as not found.\n"); | ||
175 | } catch (System.IO.FileNotFoundException) | ||
176 | { | ||
177 | MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n"); | ||
178 | } catch (System.IO.IOException) | ||
179 | { | ||
180 | // Destination file exists already or a hard drive failure... .. so we can just drop this one | ||
181 | //MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n"); | ||
182 | } catch (System.NotSupportedException) | ||
183 | { | ||
184 | MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, The current directory is invalid.\n"); | ||
185 | } | ||
186 | |||
187 | } | ||
188 | if (!(StanaloneCommon_ProperCased || StanaloneCommon_lowercased)) | ||
189 | { | ||
190 | try | ||
191 | { | ||
192 | File.Copy(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini.example"), | ||
193 | Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini")); | ||
194 | } | ||
195 | catch (UnauthorizedAccessException) | ||
196 | { | ||
197 | MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, Make sure OpenSim has the required permissions\n"); | ||
198 | } | ||
199 | catch (ArgumentException) | ||
200 | { | ||
201 | MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, The current directory is invalid.\n"); | ||
202 | } | ||
203 | catch (System.IO.PathTooLongException) | ||
204 | { | ||
205 | MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the Path to these files is too long.\n"); | ||
206 | } | ||
207 | catch (System.IO.DirectoryNotFoundException) | ||
208 | { | ||
209 | MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the current directory is reporting as not found.\n"); | ||
210 | } | ||
211 | catch (System.IO.FileNotFoundException) | ||
212 | { | ||
213 | MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the example is not found, please make sure that the example files exist.\n"); | ||
214 | } | ||
215 | catch (System.IO.IOException) | ||
216 | { | ||
217 | // Destination file exists already or a hard drive failure... .. so we can just drop this one | ||
218 | //MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n"); | ||
219 | } | ||
220 | catch (System.NotSupportedException) | ||
221 | { | ||
222 | MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, The current directory is invalid.\n"); | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | MainConsole.Instance = null; | ||
227 | } | ||
228 | |||
123 | configSource.Alias.AddAlias("On", true); | 229 | configSource.Alias.AddAlias("On", true); |
124 | configSource.Alias.AddAlias("Off", false); | 230 | configSource.Alias.AddAlias("Off", false); |
125 | configSource.Alias.AddAlias("True", true); | 231 | configSource.Alias.AddAlias("True", true); |
@@ -145,6 +251,8 @@ namespace OpenSim | |||
145 | // load Crash directory config | 251 | // load Crash directory config |
146 | m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); | 252 | m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir); |
147 | 253 | ||
254 | |||
255 | |||
148 | if (background) | 256 | if (background) |
149 | { | 257 | { |
150 | m_sim = new OpenSimBackground(configSource); | 258 | m_sim = new OpenSimBackground(configSource); |
@@ -152,8 +260,14 @@ namespace OpenSim | |||
152 | } | 260 | } |
153 | else | 261 | else |
154 | { | 262 | { |
263 | |||
264 | |||
265 | |||
266 | |||
155 | m_sim = new OpenSim(configSource); | 267 | m_sim = new OpenSim(configSource); |
156 | 268 | ||
269 | |||
270 | |||
157 | m_sim.Startup(); | 271 | m_sim.Startup(); |
158 | 272 | ||
159 | while (true) | 273 | while (true) |