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.
()
| 190 | // in various possible places of each platform and returns it. |
| 191 | // Returns blank string if none of default locations exists. |
| 192 | func 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 | |
| 214 | func winApp() string { |
| 215 | path := filepath.Join(os.Getenv("APPDATA"), "Spotify") |
no test coverage detected