[wasm] Use '/' directory separator in .blat (#52066)
authorRadek Doulik <radek.doulik@gmail.com>
Mon, 3 May 2021 19:21:40 +0000 (21:21 +0200)
committerGitHub <noreply@github.com>
Mon, 3 May 2021 19:21:40 +0000 (21:21 +0200)
Fixes: https://github.com/dotnet/runtime/issues/52007
We were using host system `PathSeparator`s, which lead to problems when
building the app on windows.

This change makes the `System.Runtime` library tests pass on windows.

src/tasks/WasmBuildTasks/GenerateWasmBundle.cs

index e504975b857c95b52952a2a6bfa410dd606b922f..c4fc6a7849fc7e1b249788d25a23ab8db6933b5c 100644 (file)
@@ -33,6 +33,9 @@ public class GenerateWasmBundle : Task
         foreach (var entry in directoryInfo.EnumerateFiles("*", SearchOption.AllDirectories))
         {
             var relativePath = Path.GetRelativePath(InputDirectory!, entry.FullName);
+            if (Path.DirectorySeparatorChar != '/')
+                relativePath = relativePath.Replace(Path.DirectorySeparatorChar, '/');
+
             indices.Add(new object[] { relativePath, entry.Length });
 
             using (var readStream = entry.OpenRead())