|
7 | 7 | using System.Text;
|
8 | 8 | using System.Text.RegularExpressions;
|
9 | 9 | using UnityPerformanceBenchmarkReporter.Entities;
|
| 10 | +using System.Runtime.InteropServices; |
10 | 11 |
|
11 | 12 | namespace UnityPerformanceBenchmarkReporter.Report
|
12 | 13 | {
|
@@ -34,6 +35,7 @@ public class ReportWriter
|
34 | 35 | private bool thisHasBenchmarkResults;
|
35 | 36 | private MetadataValidator metadataValidator;
|
36 | 37 | private bool vrSupported = false;
|
| 38 | + private char pathSeperator = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? '\\' : '/'; |
37 | 39 |
|
38 | 40 | public ReportWriter(Dictionary<string, string[]> excludedTestConfigs = null)
|
39 | 41 | {
|
@@ -101,7 +103,8 @@ private static FileStream TryCreateHtmlFile(string htmlFileName)
|
101 | 103 |
|
102 | 104 | private void WriteEmbeddedResourceFiles(DirectoryInfo benchmarkDirectory)
|
103 | 105 | {
|
104 |
| - var assemblyNameParts = Assembly.GetExecutingAssembly().Location.Split('\\'); |
| 106 | + var assemblyNameParts = Assembly.GetExecutingAssembly().Location.Split(pathSeperator); |
| 107 | + |
105 | 108 | var assemblyName = assemblyNameParts[assemblyNameParts.Length - 1].Split('.')[0];
|
106 | 109 |
|
107 | 110 | foreach (var embeddedResourceName in embeddedResourceNames)
|
@@ -468,6 +471,7 @@ private void WriteToggleCanvasWithNoFailures(StreamWriter rw)
|
468 | 471 | private void WriteHeader(StreamWriter rw)
|
469 | 472 | {
|
470 | 473 | rw.WriteLine("<head>");
|
| 474 | + rw.WriteLine("<meta charset=\"utf-8\"/>"); |
471 | 475 | rw.WriteLine("<title>Unity Performance Benchmark Report</title>");
|
472 | 476 | rw.WriteLine("<script src=\"Chart.bundle.js\"></script>");
|
473 | 477 | rw.WriteLine("<link rel=\"stylesheet\" href=\"styles.css\">");
|
@@ -766,8 +770,8 @@ private void WriteClassNameWithFields<T>(StreamWriter rw, object instance, strin
|
766 | 770 | ? mismatchedValue.First(kv => kv.Key.Equals(resultFile)).Value
|
767 | 771 | : baselineValue;
|
768 | 772 |
|
769 |
| - var pathParts = resultFile.Split('\\'); |
770 |
| - var path = string.Join('\\', pathParts.Take(pathParts.Length - 1)); |
| 773 | + var pathParts = resultFile.Split(pathSeperator); |
| 774 | + var path = string.Join(pathSeperator, pathParts.Take(pathParts.Length - 1)); |
771 | 775 |
|
772 | 776 |
|
773 | 777 | sb.Append(string.Format(
|
|
0 commit comments