mirror of
https://code.dumpstack.io/tools/wi.git
synced 2024-11-14 06:19:19 +02:00
Change path for storage
This commit is contained in:
parent
dc8b2f1b26
commit
baff8aaaff
21
main.go
21
main.go
|
@ -61,13 +61,30 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
db, err := storage.OpenDB("/tmp/wi.db")
|
homePath, exists := os.LookupEnv("HOME")
|
||||||
|
var wiDir, widbPath, wijarPath string
|
||||||
|
if exists {
|
||||||
|
wiDir = homePath + "/.wi"
|
||||||
|
widbPath = wiDir + "/wi.db"
|
||||||
|
wijarPath = wiDir + "/wi.jar"
|
||||||
|
} else {
|
||||||
|
wiDir = "/tmp"
|
||||||
|
widbPath = "/tmp/wi.db"
|
||||||
|
wijarPath = "/tmp/wi.jar"
|
||||||
|
}
|
||||||
|
|
||||||
|
err := os.MkdirAll(wiDir, 0700)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
db, err := storage.OpenDB(widbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
os.Setenv("GOCOOKIES", "/tmp/wi.jar")
|
os.Setenv("GOCOOKIES", wijarPath)
|
||||||
|
|
||||||
jar, err := cookiejar.New(nil)
|
jar, err := cookiejar.New(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue