Commit 3b52234d authored by ale's avatar ale

the --book-dir option is mandatory

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