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

Function FindPrefFilePath

src/utils/config.go:192–212  ·  view source on GitHub ↗

FindPrefFilePath finds Spotify "prefs" file location in various possible places of each platform and returns it. Returns blank string if none of default locations exists.

()

Source from the content-addressed store, hash-verified

190// in various possible places of each platform and returns it.
191// Returns blank string if none of default locations exists.
192func FindPrefFilePath() string {
193 switch runtime.GOOS {
194 case "windows":
195 path := winPrefs()
196 if len(path) == 0 && len(WinXApp()) != 0 {
197 path = WinXPrefs()
198 }
199 if len(path) == 0 {
200 PrintError("No valid path options found, ensure you have Spotify installed and have ran it for at least 30 seconds")
201 }
202 return path
203
204 case "linux":
205 return linuxPrefs()
206
207 case "darwin":
208 return darwinPrefs()
209 }
210
211 return ""
212}
213
214func winApp() string {
215 path := filepath.Join(os.Getenv("APPDATA"), "Spotify")

Callers 2

InitPathsFunction · 0.92
getDefaultConfigFunction · 0.85

Calls 6

winPrefsFunction · 0.85
WinXAppFunction · 0.85
WinXPrefsFunction · 0.85
PrintErrorFunction · 0.85
linuxPrefsFunction · 0.85
darwinPrefsFunction · 0.85

Tested by

no test coverage detected