From f3bc3ae78990948e75d0b9757c399aad4e5c3b6b Mon Sep 17 00:00:00 2001 From: sentriz Date: Tue, 11 May 2021 21:36:45 +0100 Subject: [PATCH] feat: create cache directory on startup the flag is still required - but the path need not exist the folder will eventually be created by one of if err := os.MkdirAll(cacheDirAudio, os.ModePerm); err != nil { if err := os.MkdirAll(cacheDirCovers, os.ModePerm); err != nil { fixes #127 --- cmd/gonic/gonic.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/gonic/gonic.go b/cmd/gonic/gonic.go index 5a106ea9..ffd40441 100644 --- a/cmd/gonic/gonic.go +++ b/cmd/gonic/gonic.go @@ -68,13 +68,13 @@ func main() { if _, err := os.Stat(*confPodcastPath); os.IsNotExist(err) { log.Fatal("please provide a valid podcast directory") } - if _, err := os.Stat(*confCachePath); os.IsNotExist(err) { - log.Fatal("please provide a valid cache directory") + + if *confCachePath == "" { + log.Fatal("please provide a cache directory") } cacheDirAudio := path.Join(*confCachePath, cachePrefixAudio) cacheDirCovers := path.Join(*confCachePath, cachePrefixCovers) - if _, err := os.Stat(cacheDirAudio); os.IsNotExist(err) { if err := os.MkdirAll(cacheDirAudio, os.ModePerm); err != nil { log.Fatalf("couldn't create audio cache path: %v\n", err)