Use correct path separator for satellite assemblies in cross builds (#4976)
authorMarek Habersack <grendel@twistedcode.net>
Tue, 6 Jun 2017 14:06:00 +0000 (16:06 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Jun 2017 14:06:00 +0000 (16:06 +0200)
When creating a bundle on Windows to run on Android, macOS/iOS or Linux we need
to use the target system's path separator when storing satellite assemblies in
the bundle instead of the host system's one. Failing to do so will embed (on
Windows) the satellite assemblies with paths like

   fr_FR\myassembly.resources.dll

while at runtime Mono will try to look up the assembly by

   fr_FR/myassembly.resources.dll

and fail to find it, obviously. The `--style` parameter is now consulted to see
what path separator character should be used.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=55603

mcs/tools/mkbundle/mkbundle.cs

index ab13accc034c54695fba45e8b4deecf3854a0f30..4febb86c32014b1ea38858496f77a55cf301bbe2 100755 (executable)
@@ -1126,10 +1126,10 @@ 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)
        {
+               string resourcePathSeparator = style == "windows" ? "\\\\" : "/";
                string name = Path.GetFileName (path);
 
                // A bit of a hack to support satellite assemblies. They all share the same name but