diff options
author | Melanie Thielker | 2009-06-26 00:00:20 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-06-26 00:00:20 +0000 |
commit | 5869598c4ca462bfda3b83b707c57433048f364c (patch) | |
tree | 551539a58d5c8f77654835060b39a558eb09d91a /OpenSim/Region/Application | |
parent | Make create region save the new region to ini file format if the name (diff) | |
download | opensim-SC_OLD-5869598c4ca462bfda3b83b707c57433048f364c.zip opensim-SC_OLD-5869598c4ca462bfda3b83b707c57433048f364c.tar.gz opensim-SC_OLD-5869598c4ca462bfda3b83b707c57433048f364c.tar.bz2 opensim-SC_OLD-5869598c4ca462bfda3b83b707c57433048f364c.tar.xz |
Make delete-region delete the section from an ini file. Will delete the whole
file if it has no sections left.
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSimBase.cs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 1ff53c9..9e3dafb 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -465,8 +465,34 @@ namespace OpenSim | |||
465 | 465 | ||
466 | if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile)) | 466 | if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile)) |
467 | { | 467 | { |
468 | File.Delete(scene.RegionInfo.RegionFile); | 468 | if (scene.RegionInfo.RegionFile.ToLower().EndsWith(".xml")) |
469 | m_log.InfoFormat("[OPENSIM]: deleting region file \"{0}\"", scene.RegionInfo.RegionFile); | 469 | { |
470 | File.Delete(scene.RegionInfo.RegionFile); | ||
471 | m_log.InfoFormat("[OPENSIM]: deleting region file \"{0}\"", scene.RegionInfo.RegionFile); | ||
472 | } | ||
473 | if (scene.RegionInfo.RegionFile.ToLower().EndsWith(".ini")) | ||
474 | { | ||
475 | try | ||
476 | { | ||
477 | IniConfigSource source = new IniConfigSource(scene.RegionInfo.RegionFile); | ||
478 | if (source.Configs[scene.RegionInfo.RegionName] != null) | ||
479 | { | ||
480 | source.Configs.Remove(scene.RegionInfo.RegionName); | ||
481 | |||
482 | if (source.Configs.Count == 0) | ||
483 | { | ||
484 | File.Delete(scene.RegionInfo.RegionFile); | ||
485 | } | ||
486 | else | ||
487 | { | ||
488 | source.Save(scene.RegionInfo.RegionFile); | ||
489 | } | ||
490 | } | ||
491 | } | ||
492 | catch (Exception) | ||
493 | { | ||
494 | } | ||
495 | } | ||
470 | } | 496 | } |
471 | } | 497 | } |
472 | 498 | ||