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
parent
7cc69ac97f
commit
5869598c4c
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue