aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Configuration/XML/XmlConfiguration.cs49
1 files changed, 24 insertions, 25 deletions
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
60 } 60 }
61 public void LoadData() 61 public void LoadData()
62 { 62 {
63 doc = new XmlDocument(); 63 lock (this)
64 if (File.Exists(fileName))
65 { 64 {
66 XmlTextReader reader = new XmlTextReader(fileName); 65 doc = new XmlDocument();
67 reader.WhitespaceHandling = WhitespaceHandling.None; 66 if (File.Exists(fileName))
68 doc.Load(reader); 67 {
69 reader.Close(); 68 XmlTextReader reader = new XmlTextReader(fileName);
70 } 69 reader.WhitespaceHandling = WhitespaceHandling.None;
71 else 70 doc.Load(reader);
72 { 71 reader.Close();
73 createdFile = true; 72 }
74 rootNode = doc.CreateNode(XmlNodeType.Element, "Root", ""); 73 else
75 doc.AppendChild(rootNode); 74 {
76 configNode = doc.CreateNode(XmlNodeType.Element, "Config", ""); 75 createdFile = true;
77 rootNode.AppendChild(configNode); 76 rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
78 } 77 doc.AppendChild(rootNode);
78 configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
79 rootNode.AppendChild(configNode);
80 }
79 81
80 LoadDataToClass(); 82 LoadDataToClass();
81 83
82 if (createdFile) 84 if (createdFile)
83 { 85 {
84 this.Commit(); 86 this.Commit();
87 }
85 } 88 }
86 } 89 }
87 90
@@ -123,12 +126,8 @@ namespace OpenSim.Framework.Configuration
123 if (!Directory.Exists(Util.configDir())) 126 if (!Directory.Exists(Util.configDir()))
124 { 127 {
125 Directory.CreateDirectory(Util.configDir()); 128 Directory.CreateDirectory(Util.configDir());
126 } 129 }
127 130 doc.Save(fileName);
128 lock(this)
129 {
130 doc.Save(fileName);
131 }
132 } 131 }
133 132
134 public void Close() 133 public void Close()