Skip to content

Commit

Permalink
Merge pull request #79 from lucor/fix/windows-icon-packaging
Browse files Browse the repository at this point in the history
Window resource flle need to be placed into the package root to be linked
  • Loading branch information
lucor authored Oct 7, 2021
2 parents dcb9528 + 2e657ca commit f208c48
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog - Fyne.io fyne-cross

## Unreleased

### Fixed

- Building for windows fails to add icon #66

## 1.1.2 - 05 Oct 2021

### Fixed
Expand Down
15 changes: 8 additions & 7 deletions internal/command/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/user"
"path/filepath"
"runtime"
"strings"

Expand Down Expand Up @@ -330,8 +331,6 @@ func fyneRelease(ctx Context) error {
// that will be automatically linked by compliler during the build
func WindowsResource(ctx Context) (string, error) {

windres := ctx.Name + ".syso"

args := []string{
gowindresBin,
"-arch", ctx.Architecture.String(),
Expand All @@ -346,17 +345,19 @@ func WindowsResource(ctx Context) (string, error) {

err := Run(ctx.DockerImage, ctx.Volume, runOpts, args)
if err != nil {
return windres, fmt.Errorf("could not package the Fyne app: %v", err)
return "", fmt.Errorf("could not package the Fyne app: %v", err)
}

// copy the windows resource under the project root
// copy the windows resource under the package root
// it will be automatically linked by compiler during build
err = volume.Copy(volume.JoinPathHost(ctx.TmpDirHost(), ctx.ID, windres), volume.JoinPathHost(ctx.WorkDirHost(), windres))
windres := ctx.Name + ".syso"
out := filepath.Join(ctx.Package, windres)
err = volume.Copy(volume.JoinPathHost(ctx.TmpDirHost(), ctx.ID, windres), volume.JoinPathHost(ctx.WorkDirHost(), out))
if err != nil {
return windres, fmt.Errorf("could not copy windows resource under the project root: %v", err)
return "", fmt.Errorf("could not copy windows resource under the package root: %v", err)
}

return windres, nil
return out, nil
}

// pullImage attempts to pull a newer version of the docker image
Expand Down

0 comments on commit f208c48

Please sign in to comment.