From 2db1624fafb7fcad4c9327a1efe9b4cc685ae032 Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Fri, 25 Oct 2019 17:37:36 +1100 Subject: [PATCH] 274 support spaces in windows paths (#275) * fix: escape windows commands * fix: allow spaces in path to windres * Update go.mod --- cmd/package.go | 11 +++++++++-- cmd/program.go | 1 + cmd/windres.bat | 1 + go.mod | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 cmd/windres.bat diff --git a/cmd/package.go b/cmd/package.go index 558a67946..c9b0ef83b 100644 --- a/cmd/package.go +++ b/cmd/package.go @@ -191,8 +191,15 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error { // Build syso sysofile := filepath.Join(b.fs.Cwd(), basename+"-res.syso") - windresCommand := []string{"windres", "-o", sysofile, tgtRCFile} - err := NewProgramHelper().RunCommandArray(windresCommand) + + batfile, err := fs.LocalDir(".") + if err != nil { + return err + } + + windresBatFile := filepath.Join(batfile.fullPath, "windres.bat") + windresCommand := []string{windresBatFile, sysofile, tgtRCFile} + err = NewProgramHelper().RunCommandArray(windresCommand) if err != nil { return err } diff --git a/cmd/program.go b/cmd/program.go index 680dd17ee..81816bdb3 100644 --- a/cmd/program.go +++ b/cmd/program.go @@ -128,6 +128,7 @@ func (p *ProgramHelper) RunCommandArray(args []string, dir ...string) error { fmt.Printf("ERROR: Looks like '%s' isn't installed. Please install and try again.", program) return err } + args = args[1:] var stderr string var stdout string diff --git a/cmd/windres.bat b/cmd/windres.bat new file mode 100644 index 000000000..1ce33a4a8 --- /dev/null +++ b/cmd/windres.bat @@ -0,0 +1 @@ +windres.exe -o %1 %2 \ No newline at end of file diff --git a/go.mod b/go.mod index fe1ff809c..435d02d39 100644 --- a/go.mod +++ b/go.mod @@ -30,4 +30,4 @@ require ( golang.org/x/text v0.3.0 gopkg.in/AlecAivazis/survey.v1 v1.8.4 gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22 -) \ No newline at end of file +)