This commit is contained in:
cdle
2021-09-26 17:31:21 +08:00
parent 5b7f8389c3
commit a8a839b44a
2 changed files with 8 additions and 7 deletions
+3 -6
View File
@@ -11,12 +11,9 @@ import (
var Duration time.Duration
func init() {
killp()
for _, arg := range os.Args {
if arg == "-d" {
initStore()
Daemon()
}
_, err := os.Stat("/etc/sillyGirl/")
if err != nil {
os.MkdirAll("/etc/sillyGirl/", os.ModePerm)
}
initStore()
ReadYaml(ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/conf/demo_config.yaml")
+5 -1
View File
@@ -2,6 +2,7 @@ package core
import (
"fmt"
"os"
"strconv"
"github.com/boltdb/bolt"
@@ -21,8 +22,11 @@ func NewBucket(name string) Bucket {
}
func initStore() {
if _, err := os.Stat(ExecPath + "/sillyGirl.cache"); err == nil {
os.Rename(ExecPath+"/sillyGirl.cache", "/etc/sillyGirl/sillyGirl.cache")
}
var err error
db, err = bolt.Open(ExecPath+"/sillyGirl.cache", 0600, nil)
db, err = bolt.Open("/etc/sillyGirl/sillyGirl.cache", 0600, nil)
if err != nil {
panic(err)
}