This commit is contained in:
Roy Crihfield 2023-06-29 16:12:47 +08:00
parent 80e02c90e3
commit feb6ccc72b
3 changed files with 5 additions and 4 deletions

View File

@ -20,7 +20,7 @@ package geth
import ( import (
"fmt" "fmt"
"os" "os"
"path" "path/filepath"
"sort" "sort"
"strconv" "strconv"
"strings" "strings"
@ -346,7 +346,7 @@ func geth(ctx *cli.Context) error {
if ctx.IsSet(utils.PluginsDirFlag.Name) { if ctx.IsSet(utils.PluginsDirFlag.Name) {
pluginsDir = ctx.String(utils.PluginsDirFlag.Name) pluginsDir = ctx.String(utils.PluginsDirFlag.Name)
} else { } else {
pluginsDir = path.Join(ctx.String(utils.DataDirFlag.Name), "plugins") pluginsDir = filepath.Join(ctx.String(utils.DataDirFlag.Name), "plugins")
} }
if err := plugins.Initialize(pluginsDir, ctx); err != nil { if err := plugins.Initialize(pluginsDir, ctx); err != nil {

View File

@ -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("<datadir>", "plugins")),
Category: flags.EthCategory, Category: flags.EthCategory,
} }
//end PluGeth code injection //end PluGeth code injection

View File

@ -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),