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

Function getDefaultConfig

src/utils/config.go:129–165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127}
128
129func getDefaultConfig() *ini.File {
130 var cfg = ini.Empty()
131
132 spotifyPath := FindAppPath()
133 prefsFilePath := FindPrefFilePath()
134
135 if len(spotifyPath) == 0 {
136 PrintError("Could not detect Spotify location")
137 } else {
138 configLayout["Setting"]["spotify_path"] = spotifyPath
139 }
140
141 if len(prefsFilePath) == 0 {
142 PrintError("Could not detect \"prefs\" file location")
143 } else {
144 configLayout["Setting"]["prefs_path"] = prefsFilePath
145 }
146
147 for sectionName, keyList := range configLayout {
148 section, err := cfg.NewSection(sectionName)
149 if err != nil {
150 panic(err)
151 }
152 for keyName, defaultValue := range keyList {
153 section.NewKey(keyName, defaultValue)
154 }
155 }
156
157 version, err := cfg.NewSection("Backup")
158 if err != nil {
159 panic(err)
160 }
161 version.Comment = "DO NOT CHANGE!"
162 version.NewKey("version", "")
163 version.NewKey("with", "")
164 return cfg
165}
166
167// FindAppPath finds Spotify location in various possible places
168// of each platform and returns it.

Callers 1

ParseConfigFunction · 0.85

Calls 3

FindAppPathFunction · 0.85
FindPrefFilePathFunction · 0.85
PrintErrorFunction · 0.85

Tested by

no test coverage detected