Skip to content

Commit

Permalink
feat: create cache directory on startup
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sentriz committed May 11, 2021
1 parent 4637cf7 commit f3bc3ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/gonic/gonic.go
Expand Up @@ -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)
Expand Down

0 comments on commit f3bc3ae

Please sign in to comment.