Handle a file ref, with backslashes, in a .resx, on a non-windows system
[mono.git] / mcs / class / System.Windows.Forms / System.Resources / ResXFileRef.cs
index ca129da51cae0419e9f303decfb84d8fe50511ba..5200d86426a514927bce318bda44ae3d77d0c7c4 100644 (file)
@@ -82,7 +82,11 @@ namespace System.Resources {
                                        }
                                }
 
-                               using (FileStream file = new FileStream (parts [0], FileMode.Open, FileAccess.Read, FileShare.Read)) {
+                               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);
                                }
@@ -90,7 +94,7 @@ namespace System.Resources {
                                if (type == typeof(System.Byte[]))
                                        return buffer;
 
-                               if (type == typeof (Bitmap) && Path.GetExtension (parts [0]) == ".ico") {
+                               if (type == typeof (Bitmap) && Path.GetExtension (filename) == ".ico") {
                                        MemoryStream ms = new MemoryStream (buffer);
                                        return new Icon (ms).ToBitmap ();
                                }