1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-08 10:51:09 +00:00

Fix token storage path

This commit is contained in:
Alexey Gusev 2021-03-05 23:40:41 +03:00
parent b9806c89e1
commit c7ab41a3b0

View File

@ -4,6 +4,7 @@ import (
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"log" "log"
"strings"
"os" "os"
"github.com/adrg/xdg" "github.com/adrg/xdg"
@ -62,10 +63,10 @@ func readTokensToUsers() {
func tokenStoragePath() string { func tokenStoragePath() string {
dir, err := xdg.DataFile("mycorrhiza/tokens.json") dir, err := xdg.DataFile("mycorrhiza/tokens.json")
if err != nil { if err != nil {
// Yes, it is unix-only, but function above rarely fails, so this block is probably never reached. log.Fatal(err)
path := "/home/" + os.Getenv("HOME") + "/.local/share/mycorrhiza/tokens.json" }
os.MkdirAll(path, 0777) if strings.HasPrefix(dir, util.WikiDir) {
return path log.Fatal("Error: Wiki storage directory includes private config files")
} }
return dir return dir
} }