diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-07-25 18:24:18 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-07-25 18:24:18 +0100 |
commit | 278eef90bffce6066a98a996a1462acd96b21d4e (patch) | |
tree | b9c791e9b6a86682d29581ee5635463598b648b3 /pkg/datamaps/config.go | |
parent | 93e049282e9a490dcb179209209f0300fbfbebb6 (diff) |
test to detect config path passes
Diffstat (limited to 'pkg/datamaps/config.go')
-rw-r--r-- | pkg/datamaps/config.go | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/pkg/datamaps/config.go b/pkg/datamaps/config.go index 6c82a9f..8dc8896 100644 --- a/pkg/datamaps/config.go +++ b/pkg/datamaps/config.go @@ -8,7 +8,7 @@ import ( ) const ( - configDirName = "datamaps-go" + configDirName = "datamaps" dbName = "datamaps.db" ) @@ -37,26 +37,7 @@ func (db *DBPathChecker) check() bool { if err != nil { log.Fatal(err) } - configPath := filepath.Join(userConfig, "datamaps") - dbPath := filepath.Join(configPath, "datamaps.db") - fmt.Fprintf(os.Stderr, "dbPath is definitely %s\n", dbPath) - if _, err := os.Stat(dbPath); os.IsNotExist(err) { - fmt.Fprintf(os.Stderr, "db does not exist\n") - return false - } - return true -} - -// DetectConfig looks for the configuration directory and -// files, and the database file needed to run the application. -func DetectDBFile() bool { - dir, err := os.UserConfigDir() - if err != nil { - log.Fatal(err) - } - // check if config folder exists - configPath := filepath.Join(dir, configDirName) - dbPath := filepath.Join(configPath, dbName) + dbPath := filepath.Join(userConfig, "datamaps.db") if _, err := os.Stat(dbPath); os.IsNotExist(err) { fmt.Fprintf(os.Stderr, "db does not exist\n") return false |