Skip to content

Commit

Permalink
#84
Browse files Browse the repository at this point in the history
  • Loading branch information
viniciussanchez committed May 6, 2022
1 parent fba602b commit da49a54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions core/registry/registry_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"os"

"github.com/hashload/boss/consts"
"github.com/hashload/boss/msg"
"github.com/hashload/boss/utils"
"golang.org/x/sys/windows/registry"
)
Expand All @@ -17,15 +16,14 @@ func getDelphiVersionFromRegistry() map[string]string {

delphiVersions, err := registry.OpenKey(registry.CURRENT_USER, consts.RegistryBasePath, registry.ALL_ACCESS)
if err != nil {
msg.Err("Cannot open registry to IDE version")
return result
}

keyInfo, err := delphiVersions.Stat()
if err != nil {
msg.Err("Cannot open Delphi registry")
return result
}

names, err := delphiVersions.ReadSubKeyNames(int(keyInfo.SubKeyCount))
utils.HandleError(err)

Expand Down
8 changes: 5 additions & 3 deletions utils/dcc32/dcc32.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ import (
"os/exec"
"path/filepath"
"strings"

"github.com/hashload/boss/msg"
)

func GetDcc32DirByCmd() []string {
command := exec.Command("where", "dcc32")
output, err := command.Output()

if err != nil {
msg.Warn("dcc32 not found")
return []string{}
}

outputStr := strings.ReplaceAll(string(output), "\t", "")
outputStr = strings.ReplaceAll(outputStr, "\r", "")
outputStr = strings.ReplaceAll(outputStr, "\n", "")

if len(outputStr) == 0 {
return []string{}
}

installations := strings.Split(outputStr, "\n")
for key, value := range installations {
installations[key] = filepath.Dir(value)
}

return installations
}

0 comments on commit da49a54

Please sign in to comment.