[Mono-dev] [Patch] xbuild, ResXFileRef and relative windows paths

Ankit Jain radical at gmail.com
Sat Mar 21 19:09:35 EDT 2009


+				// set correct basepath to resolve relative paths in file refs
+				if (reader is System.Resources.ResXResourceReader)
+					((System.Resources.ResXResourceReader) reader).BasePath =
Path.GetDirectoryName (Path.GetFullPath (sname));
+

You can do this in GetReader method. The BasePath should be set only
if UseSourcePath
is true. Fully qualifying ResXResourceReader is not required.

After this, ok to commit.
-Ankit

2009/3/22 Daniel Nauck <dna at mono-project.de>:
> Hello,
>
> i've found 2 problems while i was trying to compile a visual studio
> project with xbuild that contains ResXFileRefs.
>
> 1.) xbuild doesn't set the BasePath property of
> System.Resources.ResXResourceReader.
>
> The first patch fixed this issue. Before that change ResXFileRefs with
> relative paths was ralative to the xbuild working dictionary which was
> wrong in most cases.
>
> Example:
>
> Project dir: /home/mono/Validator
> Resx file in: /home/mono/Validator/Properties/Resources.resx
> with ResXFileRef: <value>..\Resources\dialog.bmp;System.Drawing.Bitmap,[...]
> Bitmap in: /home/mono/Validator/Resources/dialog.bmp
>
> During compiling resolved to:
> /home/mono/Validator/..\Resources\dialog.bmp
>
> With the patch the result is:
> /home/mono/Validator/Properties/..\Resources\dialog.bmp
>
> @Ankit: Please approve and let me know if its ok to commit, thanks.
>
>
>
> 2.) ResXFileRef class is not abel to handle resx files with file refs
> that contains windows paths. This happens when you use for example
> visual studio and add images or other file refs to your resource files.
>
> It looks like this:
>
> <data name="dialog" type="System.Resources.ResXFileRef,
> System.Windows.Forms">
> <value>..\Resources\dialog.bmp;System.Drawing.Bitmap, System.Drawing,
> Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
> </data>
>
> the resulting file path is:
> /home/mono/Validator/Properties/..\Resources\dialog.bmp
>
> So the second patch implements compability to resx files with file refs
> that was generated under windows and replaces the windows path separator
> with the unix path separator (if required).
>
> xbuild does the same with paths in visual studio projects for
> compability reasons.
>
> I also talked to Miguel if this compability is ok. He is fine with it.
>
> @Gert: Please approve and let me know if its ok to commit, thanks.
>
>
>
> Thanks
> Daniel
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>



-- 
Blog : http://www.ankitjain.org/blog


More information about the Mono-devel-list mailing list