From 8554fb66a600413dc0b7c7fafd230ecf4180e011 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Thu, 3 Aug 2023 20:05:59 +0200 Subject: [PATCH] fix(winreg): fetch default key value resolves #4119 --- src/platform/shell_windows.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/platform/shell_windows.go b/src/platform/shell_windows.go index 7c2e2708..bcc14a6a 100644 --- a/src/platform/shell_windows.go +++ b/src/platform/shell_windows.go @@ -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