fix(winreg): fetch default key value

resolves #4119
This commit is contained in:
Jan De Dobbeleer 2023-08-03 20:05:59 +02:00 committed by Jan De Dobbeleer
parent ea610029b2
commit 8554fb66a6

View file

@ -148,9 +148,12 @@ func (env *Shell) WindowsRegistryKeyValue(path string) (*WindowsRegistryValue, e
return nil, err
}
regKey := Base(env, regPath)
if len(regKey) != 0 {
regPath = strings.TrimSuffix(regPath, `\`+regKey)
var regKey string
if !strings.HasSuffix(regPath, `\`) {
regKey = Base(env, regPath)
if len(regKey) != 0 {
regPath = strings.TrimSuffix(regPath, `\`+regKey)
}
}
var key registry.Key