forked from luisiturrios1/gowin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paths.go
71 lines (61 loc) · 2.36 KB
/
paths.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package gowin
import (
)
const (
ALL=true//Use for make ShellFolders.Context
USER=false//Use for make ShellFolders.Context
)
type ShellFolders struct {
Context bool
}
// Return string with ProgramFiles path
// Its don't use the Context value
func(s *ShellFolders)ProgramFiles()(val string){
val, _ = GetReg("HKLM", `SOFTWARE\Microsoft\Windows\CurrentVersion`, "ProgramFilesDir")
return
}
// Return string with AppData path, its use the Context defined in the ShellFolders struct
func(s *ShellFolders)AppData()(val string){
if s.Context {
val, _ = GetReg("HKLM", `Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders`, "Common AppData")
return
}
val, _ = GetReg("HKCU", `Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders`, "AppData")
return
}
// Return string with Desktop path, its use the Context defined in the ShellFolders struct
func(s *ShellFolders)Desktop()(val string){
if s.Context {
val, _ = GetReg("HKLM", `Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders`, "Common Desktop")
return
}
val, _ = GetReg("HKCU", `Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders`, "Desktop")
return
}
// Return string with Documents path, its use the Context defined in the ShellFolders struct
func(s *ShellFolders)Documents()(val string){
if s.Context {
val, _ = GetReg("HKLM", `Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders`, "Common Documents")
return
}
val, _ = GetReg("HKCU", `Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders`, "Personal")
return
}
// Return string with StarMenu root path, its use the Context defined in the ShellFolders struct
func(s *ShellFolders)StartMenu()(val string){
if s.Context {
val, _ = GetReg("HKLM", `Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders`, "Common Start Menu")
return
}
val, _ = GetReg("HKCU", `Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders`, "Start Menu")
return
}
// Return string with StarMenu programs path, its use the Context defined in the ShellFolders struct
func(s *ShellFolders)StartMenuPrograms()(val string){
if s.Context {
val, _ = GetReg("HKLM", `Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders`, "Common Programs")
return
}
val, _ = GetReg("HKCU", `Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders`, "Programs")
return
}