aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMelanie Thielker2009-06-26 00:00:20 +0000
committerMelanie Thielker2009-06-26 00:00:20 +0000
commit5869598c4ca462bfda3b83b707c57433048f364c (patch)
tree551539a58d5c8f77654835060b39a558eb09d91a
parentMake create region save the new region to ini file format if the name (diff)
downloadopensim-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.
-rw-r--r--OpenSim/Framework/RegionInfo.cs6
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs30
2 files changed, 34 insertions, 2 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index eb10fac..504b303 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -259,6 +259,8 @@ namespace OpenSim.Framework
259 259
260 newFile.Save(filename); 260 newFile.Save(filename);
261 261
262 RegionFile = filename;
263
262 return; 264 return;
263 } 265 }
264 266
@@ -273,6 +275,8 @@ namespace OpenSim.Framework
273 if (configName != String.Empty && saveFile) 275 if (configName != String.Empty && saveFile)
274 source.Save(filename); 276 source.Save(filename);
275 277
278 RegionFile = filename;
279
276 return; 280 return;
277 } 281 }
278 282
@@ -285,6 +289,8 @@ namespace OpenSim.Framework
285 289
286 ReadNiniConfig(xmlsource, configName); 290 ReadNiniConfig(xmlsource, configName);
287 291
292 RegionFile = filename;
293
288 return; 294 return;
289 } 295 }
290 catch (Exception) 296 catch (Exception)
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