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.
This commit is contained in:
Mike Pountney
2016-01-29 11:08:24 +00:00
parent d8bce08d3a
commit ac170e9ab1
+2
View File
@@ -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)
}
}