summaryrefslogtreecommitdiffstats
path: root/db/db.go
diff options
context:
space:
mode:
Diffstat (limited to 'db/db.go')
-rw-r--r--db/db.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/db/db.go b/db/db.go
index d935467..c13f6d1 100644
--- a/db/db.go
+++ b/db/db.go
@@ -14,6 +14,7 @@ import (
)
var dbPath string
+var defaultDBPath string
// Contains information about list of media that where already
// download for different feeds.
@@ -34,8 +35,8 @@ func init() {
if err != nil {
return
}
- dbPath = path.Join(h, ".config", "fern", "db.json")
-
+ defaultDBPath = path.Join(h, ".config", "fern", "db.json")
+ dbPath = defaultDBPath
}
// Reads the fern db from disk and unmarshals it into a FernDB
@@ -140,3 +141,9 @@ func (fdb *FernDB) Write() error {
}
return nil
}
+
+// Sets DB path to the default path. This function is meant to be used
+// by tests.
+func resetDBPath() {
+ dbPath = defaultDBPath
+}