@@ -3,6 +3,7 @@ package cmd
33import (
44 "bytes"
55 "os"
6+ "os/exec"
67 "path/filepath"
78 "runtime"
89 "strings"
@@ -24,6 +25,30 @@ func BlockSpotifyUpdates(disabled bool) {
2425 spotifyExecPath = filepath .Join (spotifyExecPath , ".." , "MacOS" , "Spotify" )
2526 }
2627
28+ var str , msg string
29+ if runtime .GOOS == "darwin" {
30+ homeDir , err := os .UserHomeDir ()
31+ if err != nil {
32+ utils .PrintError ("Cannot get user home directory" )
33+ return
34+ }
35+ updateDir := homeDir + "/Library/Application Support/Spotify/PersistentCache/Update"
36+ if disabled {
37+ exec .Command ("pkill" , "Spotify" ).Run ()
38+ exec .Command ("mkdir" , "-p" , updateDir ).Run ()
39+ exec .Command ("chflags" , "uchg" , updateDir ).Run ()
40+ msg = "Disabled"
41+ } else {
42+ exec .Command ("pkill" , "Spotify" ).Run ()
43+ exec .Command ("mkdir" , "-p" , updateDir ).Run ()
44+ exec .Command ("chflags" , "nouchg" , updateDir ).Run ()
45+ msg = "Enabled"
46+ }
47+
48+ utils .PrintSuccess (msg + " Spotify updates!" )
49+ return
50+ }
51+
2752 file , err := os .OpenFile (spotifyExecPath , os .O_RDWR , 0644 )
2853 if err != nil {
2954 utils .Fatal (err )
@@ -40,7 +65,6 @@ func BlockSpotifyUpdates(disabled bool) {
4065 utils .PrintError ("Can't find update endpoint in executable" )
4166 return
4267 }
43- var str , msg string
4468 if disabled {
4569 str = "no/thanks"
4670 msg = "Disabled"
0 commit comments