mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v2] Infer assetDir from embed.FS
AssetDir is now inferred from the assets, if the assets is an embed.FS, by taking the relativ path to the index.html joined with the project root. The assetDir flag still exists and can be used if the inferring doesn't work, because the provided embed.FS wasn't defined in the main package.
This commit is contained in:
@@ -49,6 +49,11 @@ func (d *DevWebServer) WindowReload() {
|
||||
func (d *DevWebServer) Run(ctx context.Context) error {
|
||||
d.ctx = ctx
|
||||
|
||||
assetdir, _ := ctx.Value("assetdir").(string)
|
||||
d.server.Get("/wails/assetdir", func(fctx *fiber.Ctx) error {
|
||||
return fctx.SendString(assetdir)
|
||||
})
|
||||
|
||||
d.server.Get("/wails/reload", func(fctx *fiber.Ctx) error {
|
||||
d.WindowReload()
|
||||
d.desktopFrontend.WindowReload()
|
||||
|
||||
Reference in New Issue
Block a user