Skip to content
Snippets Groups Projects
Commit 3b52234d authored by ale's avatar ale
Browse files

the --book-dir option is mandatory

parent d36636cc
No related branches found
No related tags found
No related merge requests found
...@@ -193,9 +193,9 @@ func b2i(b bool) int { ...@@ -193,9 +193,9 @@ func b2i(b bool) int {
} }
func expandTilde(path string) string { func expandTilde(path string) string {
if path[:2] == "~/" { if strings.HasPrefix(path, "~/") {
curUser, _ := user.Current() curUser, _ := user.Current()
return filepath.Join(curUser.HomeDir, path[2:len(path)]) return filepath.Join(curUser.HomeDir, strings.TrimPrefix(path, "~/"))
} }
return path return path
} }
...@@ -207,8 +207,8 @@ func main() { ...@@ -207,8 +207,8 @@ func main() {
if nset != 1 { if nset != 1 {
log.Fatal("Must specify one of --update, --sync, --search or --http-server") log.Fatal("Must specify one of --update, --sync, --search or --http-server")
} }
if *update && *bookDir == "" { if *bookDir == "" {
log.Fatal("Must specify --book-dir with --update") log.Fatal("Must specify --book-dir")
} }
dbdir := expandTilde(*databaseDir) dbdir := expandTilde(*databaseDir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment