@@ -14,7 +14,6 @@ import (
14
14
"github.com/ava-labs/avalanchego/config"
15
15
"github.com/ava-labs/avalanchego/utils/constants"
16
16
"github.com/ava-labs/avalanchego/utils/logging"
17
- "go.uber.org/zap"
18
17
)
19
18
20
19
func init () {
@@ -194,28 +193,23 @@ func getPort(
194
193
return port , nil
195
194
}
196
195
197
- func makeNodeDir (log logging.Logger , rootDir , nodeName string ) (string , error ) {
196
+ func setNodeDir (log logging.Logger , rootDir , nodeName string ) (string , error ) {
198
197
if rootDir == "" {
199
198
log .Warn ("no network root directory defined; will create this node's runtime directory in working directory" )
200
199
}
201
200
// [nodeRootDir] is where this node's config file, C-Chain config file,
202
201
// staking key, staking certificate and genesis file will be written.
203
202
// (Other file locations are given in the node's config file.)
204
203
// TODO should we do this for other directories? Profiles?
205
- nodeRootDir := getNodeDir (rootDir , nodeName )
204
+ nodeRootDir := filepath . Join (rootDir , nodeName )
206
205
if err := os .Mkdir (nodeRootDir , 0o755 ); err != nil {
207
206
if ! os .IsExist (err ) {
208
- return "" , fmt .Errorf ("error creating temp dir %w" , err )
207
+ return "" , fmt .Errorf ("error creating node %s dir: %w" , nodeRootDir , err )
209
208
}
210
- log .Warn ("node root directory already exists" , zap .String ("root-dir" , nodeRootDir ))
211
209
}
212
210
return nodeRootDir , nil
213
211
}
214
212
215
- func getNodeDir (rootDir string , nodeName string ) string {
216
- return filepath .Join (rootDir , nodeName )
217
- }
218
-
219
213
// createFileAndWrite creates a file with the given path and
220
214
// writes the given contents
221
215
func createFileAndWrite (path string , contents []byte ) error {
0 commit comments