tested and fixed on Windows

This commit is contained in:
AJ ONeal 2019-08-05 10:03:07 -06:00
parent c84dc517a9
commit b7989893cd
2 changed files with 18 additions and 8 deletions

View File

@ -151,12 +151,22 @@ func list(c *service.Service) ([]string, []string, []error) {
others := []string{}
for i := range regs {
reg := regs[i]
if 0 == len(cfgs) {
others = append(others, reg)
continue
}
var found bool
for j := range cfgs {
cfg := cfgs[j]
if reg != cfg.Title {
others = append(others, reg)
// Registry Value Names are case-insensitive
if strings.ToLower(reg) == strings.ToLower(cfg.Title) {
found = true
}
}
if !found {
others = append(others, reg)
}
}
return managed, others, errs
@ -218,7 +228,7 @@ func listConfigs(c *service.Service) ([]winConf, []error) {
srvs := []winConf{}
for i := range infos {
filename := strings.ToLower(infos[i].Name())
if len(filename) <= srvLen || !strings.HasSuffix(srvExt, filename) {
if len(filename) <= srvLen || !strings.HasSuffix(filename, srvExt) {
continue
}
@ -232,8 +242,8 @@ func listConfigs(c *service.Service) ([]winConf, []error) {
})
continue
}
cfg := &winConf{Filename: filename}
err = json.Unmarshal(b, cfg)
cfg := winConf{Filename: filename}
err = json.Unmarshal(b, &cfg)
if nil != err {
errs = append(errs, &ManageError{
Name: name,
@ -243,10 +253,10 @@ func listConfigs(c *service.Service) ([]winConf, []error) {
continue
}
srvs = append(srvs)
srvs = append(srvs, cfg)
}
return srvs, nil
return srvs, errs
}
func listRegistry(c *service.Service) ([]string, error) {

View File

@ -306,7 +306,7 @@ func add() {
servicemode = "SYSTEM"
}
fmt.Printf(
"SUCCESS:\n\n\t%q started as a %q %s service, running as %q\n",
"SUCCESS:\n\n\t%q started as a %s %s service, running as %q\n",
conf.Name,
servicetype,
servicemode,