Skip to content

Commit 4bbc7b4

Browse files
committed
Added GetLocalAppDataFolder and GetRoamingAppDataFolder
1 parent 51c65aa commit 4bbc7b4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

shell32_fallback.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ import (
3939
func GetDocumentsFolder() (string, error) {
4040
return "", fmt.Errorf("operating system not supported: %s", runtime.GOOS)
4141
}
42+
43+
func GetLocalAppDataFolder() (string, error) {
44+
return "", fmt.Errorf("operating system not supported: %s", runtime.GOOS)
45+
}
46+
47+
func GetRoamingAppDataFolder() (string, error) {
48+
return "", fmt.Errorf("operating system not supported: %s", runtime.GOOS)
49+
}

shell32_windows.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,24 @@ func GetDocumentsFolder() (string, error) {
7272
return getFolder(documentsFolder)
7373
}
7474

75+
// GetLocalAppDataFolder returns the LocalAppData folder
76+
func GetLocalAppDataFolder() (string, error) {
77+
return getFolder(localAppDataFolder)
78+
}
79+
80+
// GetRoamingAppDataFolder returns the AppData folder
81+
func GetRoamingAppDataFolder() (string, error) {
82+
return getFolder(roamingAppDataFolder)
83+
}
84+
7585
type folderIdentifier struct {
7686
FOLDERID *syscall.GUID
7787
CSIDL int
7888
}
7989

8090
var documentsFolder = &folderIdentifier{FOLDERID: folderIDDocuments, CSIDL: csidlMyDocuments}
91+
var roamingAppDataFolder = &folderIdentifier{FOLDERID: folderIDRoamingAppData, CSIDL: csidlAppData}
92+
var localAppDataFolder = &folderIdentifier{FOLDERID: folderIDLocalAppData, CSIDL: csidlAppData}
8193

8294
// Windows folderID constants
8395
var folderIDAddNewPrograms = &syscall.GUID{Data1: 0xDE61D971, Data2: 0x5EBC, Data3: 0x4F02, Data4: [8]byte{0xA3, 0xA9, 0x6C, 0x82, 0x89, 0x5E, 0x5C, 0x04}}

0 commit comments

Comments
 (0)