(flags ...string)
| 33 | } |
| 34 | |
| 35 | func SpotifyStart(flags ...string) { |
| 36 | enableDevtools := settingSection.Key("always_enable_devtools").MustBool(false) |
| 37 | if enableDevtools { |
| 38 | EnableDevTools() |
| 39 | } |
| 40 | |
| 41 | launchFlag := settingSection.Key("spotify_launch_flags").Strings("|") |
| 42 | if len(launchFlag) > 0 { |
| 43 | flags = append(flags, launchFlag...) |
| 44 | } |
| 45 | |
| 46 | switch runtime.GOOS { |
| 47 | case "windows": |
| 48 | if isAppX { |
| 49 | ps, _ := exec.LookPath("powershell.exe") |
| 50 | exe := filepath.Join(os.Getenv("LOCALAPPDATA"), "Microsoft", "WindowsApps", "Spotify.exe") |
| 51 | cmd := `& "` + exe + `" --app-directory="` + appDestPath + `"` |
| 52 | if len(flags) > 0 { |
| 53 | cmd += " " + strings.Join(flags, " ") |
| 54 | } |
| 55 | exec.Command(ps, "-NoProfile", "-NonInteractive", "-Command", cmd).Start() |
| 56 | } else { |
| 57 | exec.Command(filepath.Join(spotifyPath, "spotify.exe"), flags...).Start() |
| 58 | } |
| 59 | case "linux": |
| 60 | exec.Command(filepath.Join(spotifyPath, "spotify"), flags...).Start() |
| 61 | case "darwin": |
| 62 | flags = append([]string{"-a", "/Applications/Spotify.app", "--args"}, flags...) |
| 63 | exec.Command("open", flags...).Start() |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | func SpotifyRestart(flags ...string) { |
| 68 | SpotifyKill() |
no test coverage detected