Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
ox
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itchio
ox
Commits
df307352
Commit
df307352
authored
Oct 31, 2019
by
Amos Wenger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows: add winox.FolderTypeStartMenu
parent
643554b4
Pipeline
#14904
passed with stage
in 22 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
shell32_windows.go
syscallex/shell32_windows.go
+1
-0
users_windows.go
winox/users_windows.go
+3
-0
users_windows_test.go
winox/users_windows_test.go
+18
-4
No files found.
syscallex/shell32_windows.go
View file @
df307352
...
...
@@ -17,6 +17,7 @@ const (
CSIDL_APPDATA
=
0x001a
CSIDL_PROFILE
=
0x0028
CSIDL_LOCAL_APPDATA
=
0x001c
CSIDL_STARTMENU
=
0x000b
)
const
MAX_PATH
=
260
...
...
winox/users_windows.go
View file @
df307352
...
...
@@ -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
)
}
...
...
winox/users_windows_test.go
View file @
df307352
...
...
@@ -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
)
})
}
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment