Compare commits

..

No commits in common. "master" and "v0.0.2" have entirely different histories.

18
main.go
View File

@ -188,23 +188,19 @@ func getOrDownload(results *wallhaven.SearchResults, r *rand.Rand, downloadPath
}
result := results.Data[r.Intn(len(results.Data))]
fullPath := path.Join(downloadPath, path.Base(result.Path))
_, err := os.Stat(fullPath)
if err == nil {
return fullPath, nil
}
if os.IsNotExist(err) {
if _, err := os.Stat(fullPath); err != nil {
err = result.Download(path.Join(downloadPath))
if err != nil {
return "", err
}
return fullPath, nil
}
return "", err
return fullPath, nil
}
func runScript(imgPath, script string) error {
cmd := exec.Command(script, imgPath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
_, err := exec.Command(script, imgPath).Output()
if err != nil {
return err
}
return nil
}