Skip to content

Commit

Permalink
fix(macos): dotnet run path aligns directory separator
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay authored and jeromelaban committed Apr 24, 2020
1 parent 4fd6cf6 commit b42a315
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Uno.Wasm.Bootstrap.Cli/Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace Uno.Wasm.Bootstrap.Cli.Server
class Startup
{
private const string WasmMimeType = "application/wasm";
private readonly char OtherDirectorySeparatorChar = Path.DirectorySeparatorChar == '/' ? '\\' : '/';

public void ConfigureServices(IServiceCollection services)
{
Expand Down Expand Up @@ -80,7 +81,7 @@ public void Configure(IApplicationBuilder app, IConfiguration configuration)
RegisterDebuggerLookup(app, configuration);

app.UseDeveloperExceptionPage();
var pathBase = configuration.GetValue<string>("pathbase");
var pathBase = FixupPath(configuration.GetValue<string>("pathbase"));
var env = app.ApplicationServices.GetRequiredService<IHostingEnvironment>();
var contentRoot = env.ContentRootPath;

Expand Down Expand Up @@ -161,5 +162,11 @@ private static void SetCacheHeaders(StaticFileResponseContext ctx)
};
}
}

/// <summary>
/// Align paths to fix issues with mixed path
/// </summary>
string FixupPath(string path)
=> path.Replace(OtherDirectorySeparatorChar, Path.DirectorySeparatorChar);
}
}

0 comments on commit b42a315

Please sign in to comment.