Make delete-region delete the section from an ini file. Will delete the whole

file if it has no sections left.
0.6.6-post-fixes
Melanie Thielker 2009-06-26 00:00:20 +00:00
parent 7cc69ac97f
commit 5869598c4c
2 changed files with 34 additions and 2 deletions

View File

@ -259,6 +259,8 @@ namespace OpenSim.Framework
newFile.Save(filename);
RegionFile = filename;
return;
}
@ -273,6 +275,8 @@ namespace OpenSim.Framework
if (configName != String.Empty && saveFile)
source.Save(filename);
RegionFile = filename;
return;
}
@ -285,6 +289,8 @@ namespace OpenSim.Framework
ReadNiniConfig(xmlsource, configName);
RegionFile = filename;
return;
}
catch (Exception)

View File

@ -464,10 +464,36 @@ namespace OpenSim
return;
if (!String.IsNullOrEmpty(scene.RegionInfo.RegionFile))
{
if (scene.RegionInfo.RegionFile.ToLower().EndsWith(".xml"))
{
File.Delete(scene.RegionInfo.RegionFile);
m_log.InfoFormat("[OPENSIM]: deleting region file \"{0}\"", scene.RegionInfo.RegionFile);
}
if (scene.RegionInfo.RegionFile.ToLower().EndsWith(".ini"))
{
try
{
IniConfigSource source = new IniConfigSource(scene.RegionInfo.RegionFile);
if (source.Configs[scene.RegionInfo.RegionName] != null)
{
source.Configs.Remove(scene.RegionInfo.RegionName);
if (source.Configs.Count == 0)
{
File.Delete(scene.RegionInfo.RegionFile);
}
else
{
source.Save(scene.RegionInfo.RegionFile);
}
}
}
catch (Exception)
{
}
}
}
}
public void RemoveRegion(string name, bool cleanUp)