mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-06 10:00:26 +00:00
Fix token storage path
This commit is contained in:
parent
b9806c89e1
commit
c7ab41a3b0
@ -4,6 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"strings"
|
||||
"os"
|
||||
|
||||
"github.com/adrg/xdg"
|
||||
@ -62,10 +63,10 @@ func readTokensToUsers() {
|
||||
func tokenStoragePath() string {
|
||||
dir, err := xdg.DataFile("mycorrhiza/tokens.json")
|
||||
if err != nil {
|
||||
// Yes, it is unix-only, but function above rarely fails, so this block is probably never reached.
|
||||
path := "/home/" + os.Getenv("HOME") + "/.local/share/mycorrhiza/tokens.json"
|
||||
os.MkdirAll(path, 0777)
|
||||
return path
|
||||
log.Fatal(err)
|
||||
}
|
||||
if strings.HasPrefix(dir, util.WikiDir) {
|
||||
log.Fatal("Error: Wiki storage directory includes private config files")
|
||||
}
|
||||
return dir
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user