From b521e5d219759a3bd994fd8f6a1603cdcaee32fa Mon Sep 17 00:00:00 2001 From: Brian McBee Date: Tue, 11 Sep 2007 21:41:26 +0000 Subject: Another attempt at fixing the disappearing estate_settings.xml file. --- .../Configuration/XML/XmlConfiguration.cs | 49 +++++++++++----------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'OpenSim/Framework/Configuration/XML') diff --git a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs index 4ec14bc..7590834 100644 --- a/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs +++ b/OpenSim/Framework/Configuration/XML/XmlConfiguration.cs @@ -60,28 +60,31 @@ namespace OpenSim.Framework.Configuration } public void LoadData() { - doc = new XmlDocument(); - if (File.Exists(fileName)) + lock (this) { - XmlTextReader reader = new XmlTextReader(fileName); - reader.WhitespaceHandling = WhitespaceHandling.None; - doc.Load(reader); - reader.Close(); - } - else - { - createdFile = true; - rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); - doc.AppendChild(rootNode); - configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); - rootNode.AppendChild(configNode); - } + doc = new XmlDocument(); + if (File.Exists(fileName)) + { + XmlTextReader reader = new XmlTextReader(fileName); + reader.WhitespaceHandling = WhitespaceHandling.None; + doc.Load(reader); + reader.Close(); + } + else + { + createdFile = true; + rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); + doc.AppendChild(rootNode); + configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); + rootNode.AppendChild(configNode); + } - LoadDataToClass(); + LoadDataToClass(); - if (createdFile) - { - this.Commit(); + if (createdFile) + { + this.Commit(); + } } } @@ -123,12 +126,8 @@ namespace OpenSim.Framework.Configuration if (!Directory.Exists(Util.configDir())) { Directory.CreateDirectory(Util.configDir()); - } - - lock(this) - { - doc.Save(fileName); - } + } + doc.Save(fileName); } public void Close() -- cgit v1.1