Add util function for creating/checking dirs

This commit is contained in:
Daniel 2019-07-04 13:47:18 +02:00
parent 13e64209a6
commit 0de310503a
4 changed files with 51 additions and 35 deletions

View file

@ -5,6 +5,7 @@ import (
"fmt"
"path/filepath"
"github.com/safing/portbase/utils"
"github.com/tevino/abool"
)
@ -28,7 +29,7 @@ func SetLocation(location string) (ok bool) {
func Initialize() error {
if initialized.SetToIf(false, true) {
err := ensureDirectory(rootDir, 0755)
err := utils.EnsureDirectory(rootDir, 0755)
if err != nil {
return fmt.Errorf("could not create/open database directory (%s): %s", rootDir, err)
}