~chrisppy/beagles-devel

check for the existance of config and cache folder if not then create it v1 APPLIED

ReK2: 1
 check for the existance of config and cache folder if not then create it

 1 files changed, 24 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~chrisppy/beagles-devel/patches/11930/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] check for the existance of config and cache folder if not then create it Export this patch

---
 main.go | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/main.go b/main.go
index 4b36249..273ce57 100644
--- a/main.go
+++ b/main.go
@@ -36,19 +36,43 @@ func main() {
	configDir := os.Getenv("BEAGLES_CFG")
	if configDir == "" {
		d, err := os.UserConfigDir()

		if err != nil {
			wlog.Fatal(err.Error())
		}

		configDir = filepath.Join(d, "beagles")

		_, err = os.Stat(configDir)
		if os.IsNotExist(err) {
			errDir := os.MkdirAll(configDir, 0755)
			if errDir != nil {
				wlog.Fatal(err)
			}

		}

	}

	cacheDir := os.Getenv("BEAGLES_DB")
	if cacheDir == "" {
		d, err := os.UserCacheDir()

		if err != nil {
			wlog.Fatal(err.Error())
		}

		cacheDir = filepath.Join(d, "beagles")

		_, err = os.Stat(cacheDir)
		if os.IsNotExist(err) {
			errDir := os.MkdirAll(cacheDir, 0755)
			if errDir != nil {
				wlog.Fatal(err)
			}

		}

	}

	// TODO: Uncomment after podcast functionality is implemented
-- 
2.28.0
Thanks for the patch, it has been applied!  I just had to apply some of my preferred formatting
and fix the security warning output from make check.

Thanks,
Chris