[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mono-winforms-list
Subject:    Re: [Mono-winforms-list] DirectorySeperatorChar ins ResXFiles.
From:       Valentin Sawadski <valentin.sawadski () gmx ! de>
Date:       2007-08-21 13:14:59
Message-ID: 1187702099.7436.3.camel () pi1536 ! local
[Download RAW message or body]

Hello again,

I forgot in my previous submission to check if we are running on Unix.
Attached path corrects this.

However, I'm still not sure if this is the right way to go, so please
feel free to tell your two cents on this.

Kind Regards,
Valentin.

On Mon, 2007-08-20 at 22:35 +0200, Valentin Sawadski wrote:
> Hello all,
> 
> I've now come across an issue where resgen2 could not convert a *.resx
> file to a *.resources file.
> 
> The problem is that the file has been originally written in windows and
> uses an external file reference like "..\somedir\somefile", which causes
> a FileNotFoundException in ResXFileRef.cs on line 81 because the given
> path is directly used in that filestream.
> 
> Attached is a short hack which fixes this error but I'm not familiar
> with how these *.resx paths should be handled in general, so please feel
> free to comment on it.
> 
> Kind Regards,
> Valentin S.
> _______________________________________________
> Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-winforms-list

["ResxFileRef.diff" (ResxFileRef.diff)]

Index: ResXFileRef.cs
===================================================================
--- ResXFileRef.cs	(revision 84487)
+++ ResXFileRef.cs	(working copy)
@@ -77,7 +77,11 @@
 					}
 				}
 #endif
-
+				// Convert "\" to "/" when running on Unix.
+				int platform = (int) Environment.OSVersion.Platform;
+				if ((p == 4) || (p == 128))
+					parts [0] = parts [0].Replace ('\\', '/');
+					
 				using (FileStream file = new FileStream (parts [0], FileMode.Open, \
FileAccess.Read, FileShare.Read)) {  buffer = new byte [file.Length];
 					file.Read(buffer, 0, (int) file.Length);



_______________________________________________
Mono-winforms-list maillist  -  Mono-winforms-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-winforms-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic