~chrisppy/beagles-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

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

Details
Message ID
<49umXoyaOnXlbQqZchnP3lwzwFWPsTT4F56Dr4VJiP7pSOCqKDcynTGK6w4cPP507WAoc6CkVBjRBrhr_hHphS3nHFrRBt8tDPvqgF_ZJ_I=@hispagatos.org>
DKIM signature
pass
Download raw message
Patch: +24 -0
---
 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
Details
Message ID
<C4UM13IDPCVV.2TSTDW7SZUNW8@alpha>
In-Reply-To
<49umXoyaOnXlbQqZchnP3lwzwFWPsTT4F56Dr4VJiP7pSOCqKDcynTGK6w4cPP507WAoc6CkVBjRBrhr_hHphS3nHFrRBt8tDPvqgF_ZJ_I=@hispagatos.org> (view parent)
DKIM signature
missing
Download raw message
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
Reply to thread Export thread (mbox)