Skip to content

Commit 8554fb6

Browse files
fix(winreg): fetch default key value
resolves JanDeDobbeleer#4119
1 parent ea61002 commit 8554fb6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/platform/shell_windows.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ func (env *Shell) WindowsRegistryKeyValue(path string) (*WindowsRegistryValue, e
148148
return nil, err
149149
}
150150

151-
regKey := Base(env, regPath)
152-
if len(regKey) != 0 {
153-
regPath = strings.TrimSuffix(regPath, `\`+regKey)
151+
var regKey string
152+
if !strings.HasSuffix(regPath, `\`) {
153+
regKey = Base(env, regPath)
154+
if len(regKey) != 0 {
155+
regPath = strings.TrimSuffix(regPath, `\`+regKey)
156+
}
154157
}
155158

156159
var key registry.Key

0 commit comments

Comments
 (0)