simplify pluginsdir
This commit is contained in:
parent
80e02c90e3
commit
1a40a8f776
@ -20,7 +20,6 @@ package geth
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -342,14 +341,7 @@ func prepare(ctx *cli.Context) {
|
|||||||
// blocking mode, waiting for it to be shut down.
|
// blocking mode, waiting for it to be shut down.
|
||||||
func geth(ctx *cli.Context) error {
|
func geth(ctx *cli.Context) error {
|
||||||
//begin PluGeth code injection
|
//begin PluGeth code injection
|
||||||
var pluginsDir string
|
if err := plugins.Initialize(ctx.String(utils.PluginsDirFlag.Name), ctx); err != nil {
|
||||||
if ctx.IsSet(utils.PluginsDirFlag.Name) {
|
|
||||||
pluginsDir = ctx.String(utils.PluginsDirFlag.Name)
|
|
||||||
} else {
|
|
||||||
pluginsDir = path.Join(ctx.String(utils.DataDirFlag.Name), "plugins")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := plugins.Initialize(pluginsDir, ctx); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
prepare(ctx)
|
prepare(ctx)
|
||||||
|
@ -91,7 +91,8 @@ var (
|
|||||||
//begin PluGeth code injection
|
//begin PluGeth code injection
|
||||||
PluginsDirFlag = &flags.DirectoryFlag{
|
PluginsDirFlag = &flags.DirectoryFlag{
|
||||||
Name: "pluginsdir",
|
Name: "pluginsdir",
|
||||||
Usage: "Directory for plugins (default = datadir/plugins)",
|
Usage: "Directory for plugins",
|
||||||
|
Value: flags.DirectoryString(filepath.Join(node.DefaultDataDir(), "plugins")),
|
||||||
Category: flags.EthCategory,
|
Category: flags.EthCategory,
|
||||||
}
|
}
|
||||||
//end PluGeth code injection
|
//end PluGeth code injection
|
||||||
|
@ -58,7 +58,7 @@ func Lookup(name string, validate func(interface{}) bool) []interface{} {
|
|||||||
var DefaultPluginLoader *PluginLoader
|
var DefaultPluginLoader *PluginLoader
|
||||||
|
|
||||||
func NewPluginLoader(target string) (*PluginLoader, error) {
|
func NewPluginLoader(target string) (*PluginLoader, error) {
|
||||||
log.Info("Loading plugins from directory.", "path", target)
|
log.Info("Loading plugins from directory", "path", target)
|
||||||
pl := &PluginLoader{
|
pl := &PluginLoader{
|
||||||
Plugins: []pluginDetails{},
|
Plugins: []pluginDetails{},
|
||||||
Subcommands: make(map[string]Subcommand),
|
Subcommands: make(map[string]Subcommand),
|
||||||
|
Loading…
Reference in New Issue
Block a user