From db50451be616569395ee0ec14f677e10823258d0 Mon Sep 17 00:00:00 2001 From: Rudi Date: Mon, 21 Feb 2022 15:52:01 -0500 Subject: [PATCH] Check for existance of path instead of GOOS --- main.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 644490b..b1e4ec7 100644 --- a/main.go +++ b/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 } }