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

View File

@ -306,7 +306,7 @@ func add() {
servicemode = "SYSTEM" servicemode = "SYSTEM"
} }
fmt.Printf( 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, conf.Name,
servicetype, servicetype,
servicemode, servicemode,