Check for existance of path instead of GOOS
This commit is contained in:
9
main.go
9
main.go
@ -6,7 +6,6 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/reujab/wallpaper"
|
||||
)
|
||||
@ -29,7 +28,7 @@ func main() {
|
||||
}
|
||||
err = wallpaper.SetFromURL(apod.Hdurl)
|
||||
if err != nil {
|
||||
log.Fatalf("\nUnable to set wallpaper\n")
|
||||
log.Fatalf("\nUnable to set wallpaper: %+v\n", err)
|
||||
return
|
||||
}
|
||||
err = wallpaper.SetMode(wallpaper.Center)
|
||||
@ -37,11 +36,11 @@ func main() {
|
||||
log.Fatalf("\nUnable to set wallpaper mode\n")
|
||||
return
|
||||
}
|
||||
|
||||
if runtime.GOOS != "windows" {
|
||||
// https://gist.github.com/mattes/d13e273314c3b3ade33f
|
||||
if _, err := os.Stat("/usr/share/backgrounds/spaceface"); !os.IsNotExist(err) {
|
||||
err = downloadFile("/usr/share/backgrounds/spaceface/lock.jpg", apod.Hdurl)
|
||||
if err != nil {
|
||||
log.Fatalf("\nUnable to Download lock.jpg image\n")
|
||||
log.Fatalf("\nUnable to Download lock.jpg image: %+v\n", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user