win: copy debug self to debug location

This commit is contained in:
AJ ONeal 2019-07-04 03:36:58 -06:00
parent 3252a7f39f
commit 00749b3465
1 ha cambiato i file con 5 aggiunte e 1 eliminazioni

Vedi File

@ -100,11 +100,15 @@ func install(c *service.Service) error {
func installServiceman(c *service.Service) ([]string, error) { func installServiceman(c *service.Service) ([]string, error) {
// TODO check version and upgrade or dismiss // TODO check version and upgrade or dismiss
self := os.Args[0] self := os.Args[0]
debug := ""
if strings.Contains(self, "debug.exe") {
debug = "debug."
}
smdir := `\opt\serviceman` smdir := `\opt\serviceman`
// TODO support service level services (which probably wouldn't need serviceman) // TODO support service level services (which probably wouldn't need serviceman)
smdir = filepath.Join(c.Home, ".local", smdir) smdir = filepath.Join(c.Home, ".local", smdir)
// for now we'll scope the runner to the name of the application // for now we'll scope the runner to the name of the application
smbin := filepath.Join(smdir, `bin\serviceman.`+c.Name+`.exe`) smbin := filepath.Join(smdir, `bin\serviceman.`+debug+c.Name+`.exe`)
if smbin != self { if smbin != self {
err := os.MkdirAll(filepath.Dir(smbin), 0755) err := os.MkdirAll(filepath.Dir(smbin), 0755)