Create Data Folder if it does not exist

This commit is contained in:
Deluan 2020-07-10 21:43:09 -04:00
parent c2f40ea8a3
commit 74cf0ee1c1
1 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,11 @@ func Load() {
fmt.Println("Error parsing config:", err)
os.Exit(1)
}
err = os.MkdirAll(Server.DataFolder, os.ModePerm)
if err != nil {
fmt.Println("Error creating data path:", "path", Server.DataFolder, err)
os.Exit(1)
}
Server.ConfigFile = viper.GetViper().ConfigFileUsed()
if Server.DbPath == "" {
Server.DbPath = filepath.Join(Server.DataFolder, consts.DefaultDbPath)