Commit df307352 authored by Amos Wenger's avatar Amos Wenger

windows: add winox.FolderTypeStartMenu

parent 643554b4
Pipeline #14904 passed with stage
in 22 seconds
......@@ -17,6 +17,7 @@ const (
CSIDL_APPDATA = 0x001a
CSIDL_PROFILE = 0x0028
CSIDL_LOCAL_APPDATA = 0x001c
CSIDL_STARTMENU = 0x000b
)
const MAX_PATH = 260
......
......@@ -16,6 +16,7 @@ const (
FolderTypeProfile FolderType = iota
FolderTypeAppData
FolderTypeLocalAppData
FolderTypeStartMenu
)
func GetFolderPath(folderType FolderType) (string, error) {
......@@ -27,6 +28,8 @@ func GetFolderPath(folderType FolderType) (string, error) {
csidl = syscallex.CSIDL_APPDATA
case FolderTypeLocalAppData:
csidl = syscallex.CSIDL_LOCAL_APPDATA
case FolderTypeStartMenu:
csidl = syscallex.CSIDL_STARTMENU
default:
return "", errors.Errorf("Unknown folder type: %d", folderType)
}
......
......@@ -8,10 +8,24 @@ import (
)
func Test_GetFolderPath(t *testing.T) {
{
s, err := winox.GetFolderPath(winox.FolderTypeProfile)
assert.NoError(t, err)
assert.NotEmpty(t, s)
type tcase struct {
name string
typ winox.FolderType
}
cases := []tcase{
tcase{name: "appData", typ: winox.FolderTypeAppData},
tcase{name: "localAppData", typ: winox.FolderTypeLocalAppData},
tcase{name: "profile", typ: winox.FolderTypeProfile},
tcase{name: "startMenu", typ: winox.FolderTypeStartMenu},
}
for _, cas := range cases {
t.Run(cas.name, func(t *testing.T) {
s, err := winox.GetFolderPath(cas.typ)
assert.NoError(t, err)
assert.NotEmpty(t, s)
})
}
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment