Skip to content

Commit

Permalink
自动创建数据目录
Browse files Browse the repository at this point in the history
  • Loading branch information
nybuxtsui committed Sep 29, 2014
1 parent b0de813 commit 7db251b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bdb/bdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package bdb
import (
"errors"
"github.com/nybuxtsui/bdbd/log"
"os"
"strconv"
"sync"
"time"
Expand Down Expand Up @@ -78,6 +79,10 @@ func Start(config BdbConfig) *DbEnv {
log.Fatal("bdb|homedir_missing")
}
args = append(args, "-h", config.HomeDir)
_, err := os.Stat(config.HomeDir)
if err != nil && os.IsNotExist(err) {
os.Mkdir(config.HomeDir, os.ModePerm)
}
if config.LocalAddr == "" {
log.Fatal("bdb|localaddr_missing")
}
Expand Down

0 comments on commit 7db251b

Please sign in to comment.