guark / guark

Build awesome Golang desktop apps and beautiful interfaces with Vue.js, React.js, Framework 7, and more...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Embeded resources on Windows is created using \ instead of / in resource path

SGarno opened this issue · comments

Device:

  • OS: Windows
  • Version: 10
  • Go Version: 1.15

Describe the bug
On windows, a guark build generates embedded paths using \ instead of /.

This creates a build error

⠇ Building Windows App...# example.com/test/myApp/lib
lib\embed.go:13:5: unknown escape
lib\embed.go:15:3: duplicate key "" in map literal
        previous key at lib\embed.go:13:3
lib\embed.go:15:5: unknown escape
lib\embed.go:16:3: duplicate key "" in map literal
        previous key at lib\embed.go:13:3
lib\embed.go:16:5: unknown escape
lib\embed.go:17:3: duplicate key "" in map literal
        previous key at lib\embed.go:13:3
lib\embed.go:17:5: unknown escape
lib\embed.go:18:3: duplicate key "" in map literal
        previous key at lib\embed.go:13:3
lib\embed.go:18:5: unknown escape

To Reproduce
Steps to reproduce the behavior:

  1. Install guark on windows
  2. Build demo

Expected behavior

File IDs should be

"/css/app.1748279e.css": &[]byte{...}

instead of

"\css\app.1748279e.css": &[]byte{...}

Additional context
Hack:

		embeds = append(embeds, &Item{
			ID:   strings.Replace(files[i], e.Root, "", 1),
			Path: files[i],
			Data: gzdata.Bytes(),
		})

to

		embeds = append(embeds, &Item{
			ID:   strings.Replace(strings.Replace(files[i], e.Root, "", 1), "\\", "/", -1),
			Path: files[i],
			Data: gzdata.Bytes(),
		})