node: add InstanceDir method
This commit is contained in:
parent
1aaa599147
commit
cc0064b267
@ -268,7 +268,7 @@ func (c *Config) name() string {
|
|||||||
return c.Name
|
return c.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
// These resources are resolved differently for the "geth" and "geth-testnet" instances.
|
// These resources are resolved differently for "geth" instances.
|
||||||
var isOldGethResource = map[string]bool{
|
var isOldGethResource = map[string]bool{
|
||||||
"chaindata": true,
|
"chaindata": true,
|
||||||
"nodes": true,
|
"nodes": true,
|
||||||
@ -297,7 +297,14 @@ func (c *Config) resolvePath(path string) string {
|
|||||||
return oldpath
|
return oldpath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return filepath.Join(c.DataDir, c.name(), path)
|
return filepath.Join(c.instanceDir(), path)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Config) instanceDir() string {
|
||||||
|
if c.DataDir == "" {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return filepath.Join(c.DataDir, c.name())
|
||||||
}
|
}
|
||||||
|
|
||||||
// NodeKey retrieves the currently configured private key of the node, checking
|
// NodeKey retrieves the currently configured private key of the node, checking
|
||||||
|
@ -601,10 +601,16 @@ func (n *Node) Service(service interface{}) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DataDir retrieves the current datadir used by the protocol stack.
|
// DataDir retrieves the current datadir used by the protocol stack.
|
||||||
|
// Deprecated: No files should be stored in this directory, use InstanceDir instead.
|
||||||
func (n *Node) DataDir() string {
|
func (n *Node) DataDir() string {
|
||||||
return n.config.DataDir
|
return n.config.DataDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InstanceDir retrieves the instance directory used by the protocol stack.
|
||||||
|
func (n *Node) InstanceDir() string {
|
||||||
|
return n.config.instanceDir()
|
||||||
|
}
|
||||||
|
|
||||||
// AccountManager retrieves the account manager used by the protocol stack.
|
// AccountManager retrieves the account manager used by the protocol stack.
|
||||||
func (n *Node) AccountManager() *accounts.Manager {
|
func (n *Node) AccountManager() *accounts.Manager {
|
||||||
return n.accman
|
return n.accman
|
||||||
|
Loading…
Reference in New Issue
Block a user