aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2009-06-25 23:31:55 +0000
committerMelanie Thielker2009-06-25 23:31:55 +0000
commit7cc69ac97fb577807329ad71a8204985862c1757 (patch)
tree8375a3d93981b7d6786d0f517f44dc7f530534a6
parentFrom this version onwards, all new region files created automatically will (diff)
downloadopensim-SC-7cc69ac97fb577807329ad71a8204985862c1757.zip
opensim-SC-7cc69ac97fb577807329ad71a8204985862c1757.tar.gz
opensim-SC-7cc69ac97fb577807329ad71a8204985862c1757.tar.bz2
opensim-SC-7cc69ac97fb577807329ad71a8204985862c1757.tar.xz
Make create region save the new region to ini file format if the name
specifies an ini file. If the ini file exists, the region will be added.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionInfo.cs12
-rw-r--r--OpenSim/Region/Application/OpenSim.cs38
2 files changed, 38 insertions, 12 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index eee078e..eb10fac 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -262,10 +262,17 @@ namespace OpenSim.Framework
262 return; 262 return;
263 } 263 }
264 264
265 IConfigSource source = new IniConfigSource(filename); 265 IniConfigSource source = new IniConfigSource(filename);
266
267 bool saveFile = false;
268 if (source.Configs[configName] == null)
269 saveFile = true;
266 270
267 ReadNiniConfig(source, configName); 271 ReadNiniConfig(source, configName);
268 272
273 if (configName != String.Empty && saveFile)
274 source.Save(filename);
275
269 return; 276 return;
270 } 277 }
271 278
@@ -406,7 +413,8 @@ namespace OpenSim.Framework
406 413
407 if (source.Configs.Count == 0) 414 if (source.Configs.Count == 0)
408 { 415 {
409 name = MainConsole.Instance.CmdPrompt("New region name", String.Empty); 416 if (name == String.Empty)
417 name = MainConsole.Instance.CmdPrompt("New region name", name);
410 if (name == String.Empty) 418 if (name == String.Empty)
411 throw new Exception("Cannot interactively create region with no name"); 419 throw new Exception("Cannot interactively create region with no name");
412 420
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index aef0b91..3babe72 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -443,20 +443,38 @@ namespace OpenSim
443 443
444 private void HandleCreateRegion(string module, string[] cmd) 444 private void HandleCreateRegion(string module, string[] cmd)
445 { 445 {
446 if (cmd.Length < 4 || !cmd[3].EndsWith(".xml")) 446 if (cmd.Length < 4)
447 {
448 m_log.Error("Usage: create region <region name> <region_file.xml>");
449 return;
450 }
451 if (cmd[3].EndsWith(".xml"))
452 {
453 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
454 string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
455 // Allow absolute and relative specifiers
456 if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
457 regionFile = cmd[3];
458
459 IScene scene;
460 CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene);
461 }
462 else if (cmd[3].EndsWith(".ini"))
463 {
464 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
465 string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
466 // Allow absolute and relative specifiers
467 if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
468 regionFile = cmd[3];
469
470 IScene scene;
471 CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]), true, out scene);
472 }
473 else
447 { 474 {
448 m_log.Error("Usage: create region <region name> <region_file.xml>"); 475 m_log.Error("Usage: create region <region name> <region_file.xml>");
449 return; 476 return;
450 } 477 }
451
452 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
453 string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
454 // Allow absolute and relative specifiers
455 if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
456 regionFile = cmd[3];
457
458 IScene scene;
459 CreateRegion(new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source), true, out scene);
460 } 478 }
461 479
462 private void HandleLoginEnable(string module, string[] cmd) 480 private void HandleLoginEnable(string module, string[] cmd)