diff --git a/preferences/prefs.go b/preferences/prefs.go index 093313f..060debf 100644 --- a/preferences/prefs.go +++ b/preferences/prefs.go @@ -32,7 +32,8 @@ func reload() { MACHINE_POLICY_ROOT = joinRoot("HKLM/SOFTWARE/Policies", org, app) ROOT = USER_PREFERENCE_ROOT - ROOTS = []string{MACHINE_POLICY_ROOT, USER_POLICY_ROOT, MACHINE_PREFERENCE_ROOT, ROOT} + // Policies beat Preferences in the same hive. HKLM beats HKCU. + ROOTS = []string{MACHINE_POLICY_ROOT, MACHINE_PREFERENCE_ROOT, USER_POLICY_ROOT, ROOT} POLICY_ROOTS = []string{MACHINE_POLICY_ROOT, USER_POLICY_ROOT} ACL_ROOTS = []string{USER_POLICY_ROOT, MACHINE_POLICY_ROOT, MACHINE_PREFERENCE_ROOT} SECURITY_POLICY_ROOTS = nil diff --git a/preferences/prefs_test.go b/preferences/prefs_test.go index 9d5e619..8ad5808 100644 --- a/preferences/prefs_test.go +++ b/preferences/prefs_test.go @@ -57,8 +57,8 @@ func TestReloadBuildsPolicyAndPreferenceRoots(t *testing.T) { wantRoots := []string{ "HKLM/SOFTWARE/Policies/Author Software/nvm", - "HKCU/Software/Policies/Author Software/nvm", "HKLM/SOFTWARE/Author Software/Preferences/nvm", + "HKCU/Software/Policies/Author Software/nvm", "HKCU/Software/Author Software/Preferences/nvm", } if !reflect.DeepEqual(ROOTS, wantRoots) {