From ce89c43efa9a0eb6165a7ef96ca14d7ee9263b5b Mon Sep 17 00:00:00 2001 From: niubility000 <76441520+niubility000@users.noreply.github.com> Date: Wed, 28 Feb 2024 09:32:45 +0800 Subject: [PATCH] fix: show the current used filebrowser.db in cmd window --- cmd/utils.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/utils.go b/cmd/utils.go index 2bd9e760..f070d54b 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -87,16 +87,23 @@ func python(fn pythonFunc, cfg pythonConfig) cobraFunc { data := pythonData{hadDB: true} path := getParam(cmd.Flags(), "database") + absPath, err := filepath.Abs(path) + if err != nil { + panic(err) + } exists, err := dbExists(path) if err != nil { panic(err) } else if exists && cfg.noDB { - log.Fatal(path + " already exists") + log.Fatal(absPath + " already exists") } else if !exists && !cfg.noDB && !cfg.allowNoDB { - log.Fatal(path + " does not exist. Please run 'filebrowser config init' first.") + log.Fatal(absPath + " does not exist. Please run 'filebrowser config init' first.") + } else if !exists && !cfg.noDB { + log.Println(absPath + " does not exist. initialing...") } + log.Println("Using database: " + absPath) data.hadDB = exists db, err := storm.Open(path) checkErr(err)