Update readme, store data in homedir/.name_pending instead the cwd, move client build output back to client/dist

This commit is contained in:
khlieng 2015-04-23 00:44:40 +02:00
parent 891f7b2f10
commit 65229f7a9e
4 changed files with 199 additions and 172 deletions

View file

@ -1,13 +1,27 @@
package storage
import (
"log"
"os"
"os/user"
"path"
"github.com/boltdb/bolt"
)
var db *bolt.DB
func init() {
db, _ = bolt.Open("data.db", 0600, nil)
var err error
currentUser, _ := user.Current()
appDir := path.Join(currentUser.HomeDir, ".name_pending")
os.Mkdir(appDir, 0777)
db, err = bolt.Open(path.Join(appDir, "data.db"), 0600, nil)
if err != nil {
log.Fatal("Unable to open database file")
}
db.Update(func(tx *bolt.Tx) error {
tx.CreateBucketIfNotExists([]byte("Users"))