Ability to override bookmarks directory

This commit is contained in:
Pavel Kiselev
2017-01-24 07:55:18 +07:00
parent f6f40ab707
commit 9b1d915dd1
3 changed files with 29 additions and 24 deletions

View File

@@ -62,9 +62,13 @@ func fileBasename(path string) string {
return strings.Replace(filename, filepath.Ext(path), "", 1)
}
func Path() string {
path, _ := homedir.Dir()
return fmt.Sprintf("%s/.pgweb/bookmarks", path)
func Path(overrideDir string) string {
if overrideDir == "" {
path, _ := homedir.Dir()
return fmt.Sprintf("%s/.pgweb/bookmarks", path)
}
return overrideDir
}
func ReadAll(path string) (map[string]Bookmark, error) {