Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Jain <ankit.jain@xamarin.com>2017-03-13 20:05:50 +0300
committerMarek Safar <marek.safar@gmail.com>2017-03-14 11:00:59 +0300
commit81129b83c3a89bc802ba7d7273052289b42ee577 (patch)
treea8a4fe3955c2e06504079c28261924ef48a2385d /mcs/class/System.Windows.Forms
parent8b7eee97889b581599bd15694e031f7d08c5e4de (diff)
Handle windows paths in ResXFileRef, for conversion to string case
- convert the path a little earlier to handle the case for conversion to string - Fixes earlier commit a3195b79f6fdba3a8d59f0de5a881f90dcf7d458 - And enable the corresponding test
Diffstat (limited to 'mcs/class/System.Windows.Forms')
-rw-r--r--mcs/class/System.Windows.Forms/System.Resources/ResXFileRef.cs10
-rw-r--r--mcs/class/System.Windows.Forms/Test/System.Resources/ResXFileRefTest.cs1
2 files changed, 5 insertions, 6 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Resources/ResXFileRef.cs b/mcs/class/System.Windows.Forms/System.Resources/ResXFileRef.cs
index 5200d86426a..308c92c115d 100644
--- a/mcs/class/System.Windows.Forms/System.Resources/ResXFileRef.cs
+++ b/mcs/class/System.Windows.Forms/System.Resources/ResXFileRef.cs
@@ -68,6 +68,10 @@ namespace System.Resources {
if (parts.Length == 1)
throw new ArgumentException ("value");
+ string filename = parts [0];
+ if (Path.DirectorySeparatorChar == '/')
+ filename = filename.Replace ("\\", "/");
+
Type type = Type.GetType (parts [1]);
if (type == typeof(string)) {
Encoding encoding;
@@ -77,15 +81,11 @@ namespace System.Resources {
encoding = Encoding.Default;
}
- using (TextReader reader = new StreamReader(parts [0], encoding)) {
+ using (TextReader reader = new StreamReader(filename, encoding)) {
return reader.ReadToEnd();
}
}
- string filename = parts [0];
- if (Path.DirectorySeparatorChar == '/')
- filename = filename.Replace ("\\", "/");
-
using (FileStream file = new FileStream (filename, FileMode.Open, FileAccess.Read, FileShare.Read)) {
buffer = new byte [file.Length];
file.Read(buffer, 0, (int) file.Length);
diff --git a/mcs/class/System.Windows.Forms/Test/System.Resources/ResXFileRefTest.cs b/mcs/class/System.Windows.Forms/Test/System.Resources/ResXFileRefTest.cs
index c09738e6da7..5ea7baaaafd 100644
--- a/mcs/class/System.Windows.Forms/Test/System.Resources/ResXFileRefTest.cs
+++ b/mcs/class/System.Windows.Forms/Test/System.Resources/ResXFileRefTest.cs
@@ -230,7 +230,6 @@ namespace MonoTests.System.Resources
}
[Test]
- [Category ("NotWorking")]
public void ConvertFrom_Type_String_FilePathWithBackslashes ()
{
if (Path.DirectorySeparatorChar == '\\')