tryphotino / photino.Blazor

https://tryphotino.io
Apache License 2.0
328 stars 62 forks source link

Override IFileProvider for static file assets #115

Open joHerbst72 opened 5 months ago

joHerbst72 commented 5 months ago

In the moment Photino uses hardcoded PhysicalFileProvider to search for static file assets (´wwwroot´) in AppDomain.CurrentDomain.BaseDirectory.

// ServiceCollectionExtensions.cs
...
.AddSingleton<IFileProvider>(_ =>
{
    var root = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot");
    return new PhysicalFileProvider(root);
})

It would be fine if there is a possiblity to override IFileProvider, for example use ManifestEmbeddedFileProvider or create a PhysicalFileProvider which points to a different wwwroot-path:

var embeddedFileProvider = new ManifestEmbeddedFileProvider(Assembly.GetAssembly(type: typeof(Program)), "wwwroot");
var appBuilder = PhotinoBlazorAppBuilder.CreateDefault(embeddedFileProvider, args);

This would allow a more flexibel way to package photino desktop applications.