Skip to content

🎧 Your Personal Streaming Service

Force dbPath to be relative to main executable

Deluan10221b54716c
diff --git a/persistence/db_storm/storm.go b/persistence/db_storm/storm.go
index 8fa284f5f..7102b2472 100644
--- a/persistence/db_storm/storm.go
+++ b/persistence/db_storm/storm.go
@@ -1,7 +1,10 @@
package db_storm
import (
+ "fmt"
+ "os"
"path"
+ "path/filepath"
"sync"
"github.com/asdine/storm"
@@ -16,7 +19,12 @@ var (
func Db() *storm.DB {
once.Do(func() {
+ err := os.MkdirAll(conf.Sonic.DbPath, 0700)
+ if err != nil {
+ panic(err)
+ }
dbPath := path.Join(conf.Sonic.DbPath, "storm.db")
+ dbPath = fmt.Sprintf(".%c%s", filepath.Separator, dbPath)
instance, err := storm.Open(dbPath)
log.Debug("Opening Storm DB from: " + dbPath)
if err != nil {