diff options
author | MatthewDiamond <matthewdiamond96@gmail.com> | 2014-05-08 15:03:07 +0400 |
---|---|---|
committer | MatthewDiamond <matthewdiamond96@gmail.com> | 2014-05-08 15:03:07 +0400 |
commit | c65a3d39d7ae315922d05ba06b446d67db4afd01 (patch) | |
tree | d40f394bb0f1d8a9f6c04d6fc65c01a14120c6ad /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools | |
parent | acb0b0e06c98ce7127f8291ea3d60e1e9f295ff8 (diff) |
[Ide] Fix for resx Generator resource locating
Stops ResXFileCodeGenerator from looking for files based off the IDE's path.
More specifically, when the StronglyTypedResourceBuilder comes in contact with say "..\Resources\Test.ico", since it has no base directory, it uses the exe's path (as is standard) as opposed to what it is supposed to do.
Fix for bug #19610
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs index 4463ce0235..289b8b771e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs @@ -41,6 +41,9 @@ using System.CodeDom.Compiler; using System.CodeDom; using System.Linq; using MonoDevelop.Core.Assemblies; +using System.Resources; +using System.Collections.Generic; +using System.Collections; namespace MonoDevelop.Ide.CustomTools { @@ -71,10 +74,20 @@ namespace MonoDevelop.Ide.CustomTools var outputfile = file.FilePath.ChangeExtension (".Designer." + provider.FileExtension); var ns = CustomToolService.GetFileNamespace (file, outputfile); var cn = provider.CreateValidIdentifier (file.FilePath.FileNameWithoutExtension); + var rd = new Dictionary<object, object> (); - string[] unmatchable; - var ccu = StronglyTypedResourceBuilder.Create (file.FilePath, cn, ns, provider, internalClass, out unmatchable); + using (var r = new ResXResourceReader (file.FilePath)) { + r.UseResXDataNodes = true; + r.BasePath = Path.GetDirectoryName (file.FilePath.ParentDirectory); + + foreach(DictionaryEntry e in r) { + rd.Add (e.Key, e.Value); + } + } + string[] unmatchable; + var ccu = StronglyTypedResourceBuilder.Create (rd, cn, ns, provider, internalClass, out unmatchable); + if (TargetsPcl2Framework (dnp)) { FixupPclTypeInfo (ccu); } |