diff --git a/main.go b/main.go index 9be0d74..10a7875 100644 --- a/main.go +++ b/main.go @@ -768,13 +768,13 @@ func chocoMake(c *cli.Context) error { } if changelogCmd != "" { - windows, err2 := stringexec.Command(changelogCmd) - if err2 != nil { + windows, err := stringexec.Command(changelogCmd) + if err != nil { return cli.NewExitError(err.Error(), 1) } windows.Stderr = os.Stderr - out, err3 := windows.Output() - if err3 != nil { + out, err := windows.Output() + if err != nil { return cli.NewExitError(fmt.Sprintf("Failed to execute command to generate the changelog:%q\n%v", changelogCmd, err.Error()), 1) } sout := string(out) @@ -787,13 +787,13 @@ func chocoMake(c *cli.Context) error { wixFile.Choco.ChangeLog = sout } - if err = util.CopyFile(filepath.Join(wixFile.Choco.BuildDir, wixFile.Choco.MsiFile), input); err != nil { + if err := util.CopyFile(filepath.Join(wixFile.Choco.BuildDir, wixFile.Choco.MsiFile), input); err != nil { return cli.NewExitError(err.Error(), 1) } for _, tpl := range templates { dst := filepath.Join(out, filepath.Base(tpl)) - err = tpls.GenerateTemplate(&wixFile, tpl, dst) + err := tpls.GenerateTemplate(&wixFile, tpl, dst) if err != nil { return cli.NewExitError(err.Error(), 1) } diff --git a/manifest/index.go b/manifest/index.go index 6335a8f..e9b2995 100644 --- a/manifest/index.go +++ b/manifest/index.go @@ -25,6 +25,7 @@ type WixManifest struct { UpgradeCode string `json:"upgrade-code"` Files WixFiles `json:"files,omitempty"` Directories []string `json:"directories,omitempty"` + DirNames []string `json:"-"` RelDirs []string `json:"-"` Env WixEnvList `json:"env,omitempty"` Shortcuts WixShortcuts `json:"shortcuts,omitempty"` @@ -205,6 +206,7 @@ func (wixFile *WixManifest) RewriteFilePaths(out string) error { } } for _, d := range wixFile.Directories { + wixFile.DirNames = append(wixFile.DirNames, filepath.Base(d)) d, err = filepath.Abs(d) if err != nil { return err diff --git a/templates/product.wxs b/templates/product.wxs index 072454b..5f3f84e 100644 --- a/templates/product.wxs +++ b/templates/product.wxs @@ -38,8 +38,8 @@ {{end}} {{end}} - {{if gt (.Directories | len) 0}} - {{range $i, $e := .Directories}} + {{if gt (.DirNames | len) 0}} + {{range $i, $e := .DirNames}} {{end}} {{end}} diff --git a/testing/hello/assets/dir1/file2 b/testing/hello/some/assets/dir1/file2 similarity index 100% rename from testing/hello/assets/dir1/file2 rename to testing/hello/some/assets/dir1/file2 diff --git a/testing/hello/assets/file1 b/testing/hello/some/assets/file1 similarity index 100% rename from testing/hello/assets/file1 rename to testing/hello/some/assets/file1 diff --git a/testing/hello/wix.json b/testing/hello/wix.json index cbdf4ed..93eb350 100644 --- a/testing/hello/wix.json +++ b/testing/hello/wix.json @@ -10,7 +10,7 @@ ] }, "directories": [ - "assets" + "some/assets" ], "env": { "guid": "",