MCPcopy
hub / github.com/spicetify/cli / GetSpicetifyFolder

Function GetSpicetifyFolder

src/utils/path-utils.go:88–117  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88func GetSpicetifyFolder() string {
89 result, isAvailable := os.LookupEnv("SPICETIFY_CONFIG")
90 defer func() { CheckExistAndCreate(result) }()
91
92 if isAvailable && len(result) > 0 {
93 return result
94 }
95
96 if runtime.GOOS == "windows" {
97 parent := os.Getenv("APPDATA")
98
99 result = filepath.Join(parent, "spicetify")
100 } else if runtime.GOOS == "linux" {
101 parent, isAvailable := os.LookupEnv("XDG_CONFIG_HOME")
102
103 if !isAvailable || len(parent) == 0 {
104 parent = filepath.Join(os.Getenv("HOME"), ".config")
105 CheckExistAndCreate(parent)
106 }
107
108 result = filepath.Join(parent, "spicetify")
109 } else if runtime.GOOS == "darwin" {
110 parent := filepath.Join(os.Getenv("HOME"), ".config")
111 CheckExistAndCreate(parent)
112
113 result = filepath.Join(parent, "spicetify")
114 }
115
116 return result
117}
118
119func GetStateFolder(name string) string {
120 result, isAvailable := os.LookupEnv("SPICETIFY_STATE")

Callers 6

mainFunction · 0.92
ShowConfigDirectoryFunction · 0.92
cmd.goFile · 0.92
MigrateConfigFolderFunction · 0.85
MigrateFoldersFunction · 0.85
path-utils.goFile · 0.85

Calls 1

CheckExistAndCreateFunction · 0.85

Tested by

no test coverage detected