From 32d876f09b55bb103381bf8bf41036f5dadd0172 Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Thu, 31 Oct 2019 18:54:35 +0100 Subject: [PATCH] windows: Add winox.FolderTypePrograms --- syscallex/shell32_windows.go | 1 + winox/users_windows.go | 3 +++ winox/users_windows_test.go | 1 + 3 files changed, 5 insertions(+) diff --git a/syscallex/shell32_windows.go b/syscallex/shell32_windows.go index e68d169..c82b52f 100644 --- a/syscallex/shell32_windows.go +++ b/syscallex/shell32_windows.go @@ -18,6 +18,7 @@ const ( CSIDL_PROFILE = 0x0028 CSIDL_LOCAL_APPDATA = 0x001c CSIDL_STARTMENU = 0x000b + CSIDL_PROGRAMS = 0x0002 ) const MAX_PATH = 260 diff --git a/winox/users_windows.go b/winox/users_windows.go index af75e80..a10a874 100644 --- a/winox/users_windows.go +++ b/winox/users_windows.go @@ -17,6 +17,7 @@ const ( FolderTypeAppData FolderTypeLocalAppData FolderTypeStartMenu + FolderTypePrograms ) func GetFolderPath(folderType FolderType) (string, error) { @@ -30,6 +31,8 @@ func GetFolderPath(folderType FolderType) (string, error) { csidl = syscallex.CSIDL_LOCAL_APPDATA case FolderTypeStartMenu: csidl = syscallex.CSIDL_STARTMENU + case FolderTypePrograms: + csidl = syscallex.CSIDL_PROGRAMS default: return "", errors.Errorf("Unknown folder type: %d", folderType) } diff --git a/winox/users_windows_test.go b/winox/users_windows_test.go index 949940d..60a1008 100644 --- a/winox/users_windows_test.go +++ b/winox/users_windows_test.go @@ -18,6 +18,7 @@ func Test_GetFolderPath(t *testing.T) { tcase{name: "localAppData", typ: winox.FolderTypeLocalAppData}, tcase{name: "profile", typ: winox.FolderTypeProfile}, tcase{name: "startMenu", typ: winox.FolderTypeStartMenu}, + tcase{name: "programs", typ: winox.FolderTypePrograms}, } for _, cas := range cases {