Merge pull request #4453 from lambdageek/bug-49721
[mono.git] / mcs / class / System.Configuration / System.Configuration / AppSettingsSection.cs
index ff5945adddd919b03c2500fb548c1ec72571ae3d..65b63cdee8b266d8699e9eb47c6e565b1f84ac7e 100644 (file)
@@ -27,7 +27,6 @@
 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
 //
 
-#if NET_2_0
 using System;
 using System.ComponentModel;
 using System.Collections.Specialized;
@@ -64,7 +63,7 @@ namespace System.Configuration {
                        return Settings.IsModified ();
                }
 
-               [MonoTODO ("file path?  do we use a System.Configuration api for opening it?  do we keep it open?  do we open it writable?")]
+               [MonoInternalNote ("file path?  do we use a System.Configuration api for opening it?  do we keep it open?  do we open it writable?")]
                protected internal override void DeserializeElement (XmlReader reader, bool serializeCollectionKey)
                {
                        /* need to do this so we pick up the File attribute */
@@ -72,8 +71,12 @@ namespace System.Configuration {
 
                        if (File != "") {
                                try {
-                                       Stream s = System.IO.File.OpenRead (File);
-                                       XmlReader subreader = new XmlTextReader (s);
+                                       string filePath = File;
+                                       if (!Path.IsPathRooted (filePath))
+                                               filePath = Path.Combine (Path.GetDirectoryName (Configuration.FilePath), filePath);
+
+                                       Stream s = System.IO.File.OpenRead (filePath);
+                                       XmlReader subreader = new ConfigXmlTextReader (s, filePath);
                                        base.DeserializeElement (subreader, serializeCollectionKey);
                                        s.Close ();
                                }
@@ -92,10 +95,10 @@ namespace System.Configuration {
 
                [MonoTODO]
                protected internal override string SerializeSection (
-                       ConfigurationElement parent, string name, ConfigurationSaveMode mode)
+                       ConfigurationElement parentElement, string name, ConfigurationSaveMode saveMode)
                {
                        if (File == "") {
-                               return base.SerializeSection (parent, name, mode);
+                               return base.SerializeSection (parentElement, name, saveMode);
                        }
                        else {
                                throw new NotImplementedException ();
@@ -135,4 +138,3 @@ namespace System.Configuration {
                }
        }
 }
-#endif