aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionInfo.cs2
-rw-r--r--OpenSim/Region/Application/OpenSim.cs65
2 files changed, 36 insertions, 31 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index afc4060..ea1a594 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -393,7 +393,7 @@ namespace OpenSim.Framework
393 if (!File.Exists(filename)) // New region config request 393 if (!File.Exists(filename)) // New region config request
394 { 394 {
395 IniConfigSource newFile = new IniConfigSource(); 395 IniConfigSource newFile = new IniConfigSource();
396 ReadNiniConfig(newFile, String.Empty); 396 ReadNiniConfig(newFile, configName);
397 397
398 newFile.Save(filename); 398 newFile.Save(filename);
399 399
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index d9ec287..6834606 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -308,8 +308,13 @@ namespace OpenSim
308 "Persist objects to the database now", RunCommand); 308 "Persist objects to the database now", RunCommand);
309 309
310 m_console.Commands.AddCommand("region", false, "create region", 310 m_console.Commands.AddCommand("region", false, "create region",
311 "create region", 311 "create region [\"region name\"] <region_file.ini>",
312 "Create a new region", HandleCreateRegion); 312 "Create a new region.",
313 "The settings for \"region name\" are read from <region_file.ini>."
314 + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
315 + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
316 + "If <region_file.ini> does not exist, it will be created.",
317 HandleCreateRegion);
313 318
314 m_console.Commands.AddCommand("region", false, "restart", 319 m_console.Commands.AddCommand("region", false, "restart",
315 "restart", 320 "restart",
@@ -513,47 +518,47 @@ namespace OpenSim
513 /// Creates a new region based on the parameters specified. This will ask the user questions on the console 518 /// Creates a new region based on the parameters specified. This will ask the user questions on the console
514 /// </summary> 519 /// </summary>
515 /// <param name="module"></param> 520 /// <param name="module"></param>
516 /// <param name="cmd">0,1,region name, region XML file</param> 521 /// <param name="cmd">0,1,region name, region ini or XML file</param>
517 private void HandleCreateRegion(string module, string[] cmd) 522 private void HandleCreateRegion(string module, string[] cmd)
518 { 523 {
519 if (cmd.Length < 4) 524 string regionName = string.Empty;
525 string regionFile = string.Empty;
526 if (cmd.Length == 3)
520 { 527 {
521 MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); 528 regionFile = cmd[2];
529 }
530 else if (cmd.Length > 3)
531 {
532 regionName = cmd[2];
533 regionFile = cmd[3];
534 }
535 string extension = Path.GetExtension(regionFile).ToLower();
536 bool isXml = extension.Equals(".xml");
537 bool isIni = extension.Equals(".ini");
538 if (!isXml && !isIni)
539 {
540 MainConsole.Instance.Output("Usage: create region [\"region name\"] <region_file.ini>");
522 return; 541 return;
523 } 542 }
524 if (cmd[3].EndsWith(".xml")) 543 if (!Path.IsPathRooted(regionFile))
525 { 544 {
526 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); 545 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim();
527 string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]); 546 regionFile = Path.Combine(regionsDir, regionFile);
528 // Allow absolute and relative specifiers
529 if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
530 regionFile = cmd[3];
531
532 IScene scene;
533 RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source);
534 PopulateRegionEstateInfo(regInfo);
535 CreateRegion(regInfo, true, out scene);
536 regInfo.EstateSettings.Save();
537 } 547 }
538 else if (cmd[3].EndsWith(".ini")) 548
549 RegionInfo regInfo;
550 if (isXml)
539 { 551 {
540 string regionsDir = ConfigSource.Source.Configs["Startup"].GetString("regionload_regionsdir", "Regions").Trim(); 552 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
541 string regionFile = String.Format("{0}/{1}", regionsDir, cmd[3]);
542 // Allow absolute and relative specifiers
543 if (cmd[3].StartsWith("/") || cmd[3].StartsWith("\\") || cmd[3].StartsWith(".."))
544 regionFile = cmd[3];
545
546 IScene scene;
547 RegionInfo regInfo = new RegionInfo(cmd[2], regionFile, false, ConfigSource.Source, cmd[2]);
548 PopulateRegionEstateInfo(regInfo);
549 CreateRegion(regInfo, true, out scene);
550 regInfo.EstateSettings.Save();
551 } 553 }
552 else 554 else
553 { 555 {
554 MainConsole.Instance.Output("Usage: create region <region name> <region_file.ini>"); 556 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
555 return;
556 } 557 }
558 IScene scene;
559 PopulateRegionEstateInfo(regInfo);
560 CreateRegion(regInfo, true, out scene);
561 regInfo.EstateSettings.Save();
557 } 562 }
558 563
559 /// <summary> 564 /// <summary>