Skip to content

Commit

Permalink
windows: Add winox.FolderTypePrograms
Browse files Browse the repository at this point in the history
  • Loading branch information
fasterthanlime committed Oct 31, 2019
1 parent df30735 commit 32d876f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions syscallex/shell32_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
CSIDL_PROFILE = 0x0028
CSIDL_LOCAL_APPDATA = 0x001c
CSIDL_STARTMENU = 0x000b
CSIDL_PROGRAMS = 0x0002
)

const MAX_PATH = 260
Expand Down
3 changes: 3 additions & 0 deletions winox/users_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const (
FolderTypeAppData
FolderTypeLocalAppData
FolderTypeStartMenu
FolderTypePrograms
)

func GetFolderPath(folderType FolderType) (string, error) {
Expand All @@ -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)
}
Expand Down
1 change: 1 addition & 0 deletions winox/users_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 32d876f

Please sign in to comment.