We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dc1aafb commit 2a3ab23Copy full SHA for 2a3ab23
cmd/ipfs/init.go
@@ -2,6 +2,7 @@ package main
2
3
import (
4
"encoding/base64"
5
+ "path/filepath"
6
"errors"
7
"os"
8
@@ -71,6 +72,18 @@ func initCmd(c *commander.Command, inp []string) error {
71
72
cfg.Datastore.Path = dspath
73
cfg.Datastore.Type = "leveldb"
74
75
+ // Construct the data store if missing
76
+ if err := os.MkdirAll(dspath, os.ModeDir); err != nil {
77
+ return err
78
+ }
79
+
80
+ // Check the directory is writeable
81
+ if f, err := os.Create(filepath.Join(dspath, "._check_writeable")); err == nil {
82
+ os.Remove(f.Name())
83
+ } else {
84
+ return errors.New("Datastore '" + dspath + "' is not writeable")
85
86
87
cfg.Identity = config.Identity{}
88
89
// setup the node addresses.
0 commit comments