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:
parent
b9806c89e1
commit
c7ab41a3b0
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user