From b8dae7a6e223a5c542b053160a444211ebfb32c3 Mon Sep 17 00:00:00 2001 From: Andrey Pshenkin Date: Mon, 29 Apr 2024 22:59:04 +0100 Subject: [PATCH] Fix icon issues with windows when project name contains spaces (#3400) * fix icon issues with windows when project name contains spaces * add comment * add to change log --------- Co-authored-by: Lea Anthony --- v2/pkg/commands/build/build.go | 2 +- v2/pkg/commands/build/packager.go | 4 +++- website/src/pages/changelog.mdx | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/v2/pkg/commands/build/build.go b/v2/pkg/commands/build/build.go index 31f90878f..853943f8f 100644 --- a/v2/pkg/commands/build/build.go +++ b/v2/pkg/commands/build/build.go @@ -258,7 +258,7 @@ func execBuildApplication(builder Builder, options *Options) (string, error) { // When we finish, we will want to remove the syso file defer func() { - err := os.Remove(filepath.Join(options.ProjectData.Path, options.ProjectData.Name+"-res.syso")) + err := os.Remove(filepath.Join(options.ProjectData.Path, strings.ReplaceAll(options.ProjectData.Name, " ", "_")+"-res.syso")) if err != nil { fatal(err.Error()) } diff --git a/v2/pkg/commands/build/packager.go b/v2/pkg/commands/build/packager.go index 54aea2e67..b58cbbdf3 100644 --- a/v2/pkg/commands/build/packager.go +++ b/v2/pkg/commands/build/packager.go @@ -6,6 +6,7 @@ import ( "image" "os" "path/filepath" + "strings" "github.com/leaanthony/winicon" "github.com/tc-hib/winres" @@ -274,7 +275,8 @@ func compileResources(options *Options) error { rs.SetVersionInfo(v) } - targetFile := filepath.Join(options.ProjectData.Path, options.ProjectData.Name+"-res.syso") + // replace spaces with underscores as go build behaves weirdly with spaces in syso filename + targetFile := filepath.Join(options.ProjectData.Path, strings.ReplaceAll(options.ProjectData.Name, " ", "_")+"-res.syso") fout, err := os.Create(targetFile) if err != nil { return err diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 37ba7746e..f41b9a1bb 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -14,6 +14,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +### Fixed +- Fixed an issue with missing icon for Windows. Fixed by [@APshenkin](https://github.com/wailsapp/wails/pull/3400) + +### Changed + ## v2.8.1 - 2024-04-11 ### Added