update
This commit is contained in:
+3
-6
@@ -11,12 +11,9 @@ import (
|
|||||||
var Duration time.Duration
|
var Duration time.Duration
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
killp()
|
_, err := os.Stat("/etc/sillyGirl/")
|
||||||
for _, arg := range os.Args {
|
if err != nil {
|
||||||
if arg == "-d" {
|
os.MkdirAll("/etc/sillyGirl/", os.ModePerm)
|
||||||
initStore()
|
|
||||||
Daemon()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
initStore()
|
initStore()
|
||||||
ReadYaml(ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/conf/demo_config.yaml")
|
ReadYaml(ExecPath+"/conf/", &Config, "https://raw.githubusercontent.com/cdle/sillyGirl/main/conf/demo_config.yaml")
|
||||||
|
|||||||
+5
-1
@@ -2,6 +2,7 @@ package core
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/boltdb/bolt"
|
"github.com/boltdb/bolt"
|
||||||
@@ -21,8 +22,11 @@ func NewBucket(name string) Bucket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initStore() {
|
func initStore() {
|
||||||
|
if _, err := os.Stat(ExecPath + "/sillyGirl.cache"); err == nil {
|
||||||
|
os.Rename(ExecPath+"/sillyGirl.cache", "/etc/sillyGirl/sillyGirl.cache")
|
||||||
|
}
|
||||||
var err error
|
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 {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user