From a1c5ab12da059b50bd1a16e43a30ec6fd8d11686 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 15 Feb 2016 17:11:07 -0500 Subject: [PATCH] Writes database in current directory Former-commit-id: 23f641ab0f9e7591cd9729355a7083209d50edff [formerly 13cfdb07137c97b1097995d967a20943d1887aa0] [formerly 9a3ef830e58617e341ce2a6f9e40f97f94caec41 [formerly 3c53546c489a1492e5f7cbb7f2dbd6a4fe99a6da]] Former-commit-id: 4bab77f43c3aab85275c144e165d6fc6bb34d3ec [formerly 865f60e97d5fc21db125d28410257514e748b063] Former-commit-id: 3b7858054d1887c8ab2cccdfeaf4cd0b0bad4c7e --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 3d875d9..2da460e 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "fmt" "io/ioutil" "log" + "os" "path" "runtime" @@ -38,7 +39,8 @@ var VersionNum string func main() { VersionNum = "1.1" _, executableFile, _, _ := runtime.Caller(0) // get full path of this file - databaseFile := path.Join(path.Dir(executableFile), "data.db") + cwd, _ := os.Getwd() + databaseFile := path.Join(cwd, "data.db") flag.StringVar(&RuntimeArgs.Port, "p", ":8003", "port to bind") flag.StringVar(&RuntimeArgs.DatabaseLocation, "db", databaseFile, "location of database file") flag.StringVar(&RuntimeArgs.AdminKey, "a", RandStringBytesMaskImprSrc(50), "key to access admin priveleges")