From ac170e9ab10ecf733f92b984517d84214433bd8d Mon Sep 17 00:00:00 2001 From: Mike Pountney Date: Fri, 29 Jan 2016 11:08:24 +0000 Subject: [PATCH] Fixes #32 - make path to cookieFile if it's not present TL;DR, this ensures ~/jira.d is present, with 0755 perms. If ~/jira.d isn't present, we can't write to the cookieFile, which breaks CmdLogin. This is particularly an issue when using /etc/go-jira.yml to get an entire team using go-jira easily :) This fixes this by ensuring the cookieFile dir is present before writing to it. --- cli.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cli.go b/cli.go index 6d8baad..bd18a8c 100644 --- a/cli.go +++ b/cli.go @@ -14,6 +14,7 @@ import ( "net/url" "os" "os/exec" + "path" "runtime" "strings" "time" @@ -87,6 +88,7 @@ func (c *Cli) saveCookies(cookies []*http.Cookie) { } jsonWrite(c.cookieFile, mergedCookies) } else { + mkdir(path.Dir(c.cookieFile)) jsonWrite(c.cookieFile, cookies) } }