diff options
Diffstat (limited to 'db/db.go')
-rw-r--r-- | db/db.go | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 +} |