diff options
author | Marek Habersack <grendel@twistedcode.net> | 2017-03-09 18:25:08 +0300 |
---|---|---|
committer | Jonathan Pryor <jonpryor@vt.edu> | 2017-03-09 18:26:21 +0300 |
commit | 8f6d0f67f7b80e03f7fc5c9b695531948ede0410 (patch) | |
tree | bcb4916059013f21152143eccf951473f812ab9c | |
parent | 21c2ed435a5533719ee80647c7c3cae150e013c3 (diff) |
[mkbundle] Encode directory separator character on Windows (#4493)mono-4.8.0.520
When storing satellite assemblies, mkbundle prefixes their names with a
directory name derived from the language/locale of the assembly. It uses the
platform's default directory separator character which on Windows defaults to
'\' and that causes problems when building such a bundle on Windows since \ is
an escape sequence prefix inside strings and not escaping it with another \
leads to gcc errors when building the genrated source.
This commit fixes the problem by quoting the directory separator character
properly on Windows.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=52845
-rwxr-xr-x | mcs/tools/mkbundle/mkbundle.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs index 8ba098905c0..8be07f281f4 100755 --- a/mcs/tools/mkbundle/mkbundle.cs +++ b/mcs/tools/mkbundle/mkbundle.cs @@ -1114,6 +1114,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons static readonly Universe universe = new Universe (); static readonly Dictionary<string, string> loaded_assemblies = new Dictionary<string, string> (); + static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}"; public static string GetAssemblyName (string path) { @@ -1126,7 +1127,7 @@ void mono_register_config_for_assembly (const char* assembly_name, cons string dir = Path.GetDirectoryName (path); int idx = dir.LastIndexOf (Path.DirectorySeparatorChar); if (idx >= 0) { - name = dir.Substring (idx + 1) + Path.DirectorySeparatorChar + name; + name = dir.Substring (idx + 1) + resourcePathSeparator + name; Console.WriteLine ($"Storing satellite assembly '{path}' with name '{name}'"); } else if (!quiet) Console.WriteLine ($"Warning: satellite assembly {path} doesn't have locale path prefix, name conflicts possible"); |