diff --git a/go.mod b/go.mod index ee48f6d..08c335a 100644 --- a/go.mod +++ b/go.mod @@ -14,9 +14,4 @@ require ( golang.org/x/text v0.3.1-0.20180810153555-6e3c4e7365dd ) -require ( - github.com/davecgh/go-spew v1.1.0 // indirect - github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect -) +require github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 // indirect diff --git a/manifest/index.go b/manifest/index.go index 7c917a4..cc4c069 100644 --- a/manifest/index.go +++ b/manifest/index.go @@ -365,7 +365,7 @@ func (wixFile *WixManifest) check() error { } for _, shortcut := range wixFile.Shortcuts { switch shortcut.Location { - case "program", "desktop": + case "program", "desktop", "startup": default: return fmt.Errorf(`Invalid "location" value in shortcut: %s`, shortcut.Location) } diff --git a/msi/main.go b/msi/main.go index 314e29d..8d1961c 100644 --- a/msi/main.go +++ b/msi/main.go @@ -29,7 +29,6 @@ var TPLPATH = "" // non-windows build, use ldflags to tell about that. // Main exposes the application entry point. func Main() { - if TPLPATH == "" { // built for windows b, err := util.GetBinPath() if err != nil { @@ -201,6 +200,10 @@ func Main() { Name: "msi, m", Usage: "Path to write resulting msi file to", }, + cli.StringFlag{ + Name: "lang", + Usage: "Culture of the localization strings", + }, }, }, { @@ -247,6 +250,10 @@ func Main() { Name: "msi, m", Usage: "Path to write resulting msi file to", }, + cli.StringFlag{ + Name: "lang", + Usage: "Culture of the localization strings", + }, cli.StringFlag{ Name: "version", Usage: "The version of your program", @@ -627,6 +634,7 @@ func generateWixCommands(c *cli.Context) error { msi := c.String("msi") arch := c.String("arch") bin := c.String("bin") + lang := c.String("lang") if msi == "" { return cli.NewExitError("--msi parameter must be set", 1) @@ -680,8 +688,7 @@ func generateWixCommands(c *cli.Context) error { return cli.NewExitError(err.Error(), 1) } } - - cmdStr := wix.GenerateCmd(&wixFile, builtTemplates, msi, arch, bin) + cmdStr := wix.GenerateCmd(&wixFile, builtTemplates, msi, arch, bin, lang) targetFile := filepath.Join(out, "build.bat") err = ioutil.WriteFile(targetFile, []byte(cmdStr), 0644) @@ -720,6 +727,7 @@ func quickMake(c *cli.Context) error { arch := c.String("arch") keep := c.Bool("keep") bin := c.String("bin") + lang := c.String("lang") if msi == "" { return cli.NewExitError("--msi parameter must be set", 1) @@ -808,7 +816,7 @@ func quickMake(c *cli.Context) error { } } - cmdStr := wix.GenerateCmd(&wixFile, builtTemplates, msi, arch, bin) + cmdStr := wix.GenerateCmd(&wixFile, builtTemplates, msi, arch, bin, lang) targetFile := filepath.Join(out, "build.bat") err = ioutil.WriteFile(targetFile, []byte(cmdStr), 0644) diff --git a/templates/product.wxs b/templates/product.wxs index 332eb54..686ffb7 100644 --- a/templates/product.wxs +++ b/templates/product.wxs @@ -130,11 +130,12 @@ + {{range $i, $s := .Shortcuts}} {{if gt ($s.Icon | len) 0}}{{end}} {{range $j, $p := $s.Properties}}{{end}} diff --git a/testing/hello/wix.json b/testing/hello/wix.json index 798b85b..8efc651 100644 --- a/testing/hello/wix.json +++ b/testing/hello/wix.json @@ -115,6 +115,14 @@ "wdir": "INSTALLDIR", "icon": "ico.ico", "condition": "DESKTOPSHORTCUT ~= \"yes\"" + }, + { + "name": "hello", + "description": "hello web server", + "location": "startup", + "target": "[INSTALLDIR]hello.exe", + "wdir": "INSTALLDIR", + "icon": "ico.ico" } ], "choco": { diff --git a/wix/index.go b/wix/index.go index 4825fb0..b7d37c8 100644 --- a/wix/index.go +++ b/wix/index.go @@ -10,8 +10,7 @@ import ( var eol = "\r\n" // GenerateCmd generates required command lines to produce an msi package, -func GenerateCmd(wixFile *manifest.WixManifest, templates []string, msiOutFile, arch, path string) string { - +func GenerateCmd(wixFile *manifest.WixManifest, templates []string, msiOutFile, arch, path, lang string) string { cmd := "" cmd += filepath.Join(path, "candle") @@ -29,6 +28,9 @@ func GenerateCmd(wixFile *manifest.WixManifest, templates []string, msiOutFile, cmd += eol cmd += filepath.Join(path, "light") + " -ext WixUIExtension -ext WixUtilExtension -sacl -spdb " cmd += " -out " + msiOutFile + if lang != "" { + cmd += " -cultures:" + lang + } for _, tpl := range templates { cmd += " " + strings.Replace(filepath.Base(tpl), ".wxs", ".wixobj", -1) }