Fixed pluginDefaultDataDir

This commit is contained in:
philip-morlier 2023-10-23 13:25:54 -07:00
parent 63f8d10434
commit e35d5eb3fe
2 changed files with 6 additions and 3 deletions

View File

@ -989,9 +989,10 @@ func init() {
// if none (or the empty string) is specified. If the node is starting a testnet, // if none (or the empty string) is specified. If the node is starting a testnet,
// then a subdirectory of the specified datadir will be used. // then a subdirectory of the specified datadir will be used.
func MakeDataDir(ctx *cli.Context) string { func MakeDataDir(ctx *cli.Context) string {
// begin PluGeth injection
if path := ctx.String(DataDirFlag.Name); path == "" { if path := ctx.String(DataDirFlag.Name); path == "" {
// begin PluGeth injection
if pluginPath := pluginDefaultDataDir(path); pluginPath != "" { if pluginPath := pluginDefaultDataDir(path); pluginPath != "" {
log.Error("Inside datdir injection number one")
return pluginPath return pluginPath
} }
// end PluGeth injection // end PluGeth injection
@ -1446,6 +1447,7 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
setGraphQL(ctx, cfg) setGraphQL(ctx, cfg)
setWS(ctx, cfg) setWS(ctx, cfg)
setNodeUserIdent(ctx, cfg) setNodeUserIdent(ctx, cfg)
log.Error("calling set data dir", "cfg.datadir", cfg.DataDir)
SetDataDir(ctx, cfg) SetDataDir(ctx, cfg)
setSmartCard(ctx, cfg) setSmartCard(ctx, cfg)
@ -1510,10 +1512,12 @@ func setSmartCard(ctx *cli.Context, cfg *node.Config) {
} }
func SetDataDir(ctx *cli.Context, cfg *node.Config) { func SetDataDir(ctx *cli.Context, cfg *node.Config) {
log.Error("Inside of setDataDir", "default", node.DefaultDataDir())
// begin PluGeth injection // begin PluGeth injection
pluginPath := pluginDefaultDataDir(node.DefaultDataDir()) pluginPath := pluginDefaultDataDir(node.DefaultDataDir())
switch { switch {
case pluginPath != "" && cfg.DataDir == node.DefaultDataDir(): case pluginPath != "" && ctx.String(DataDirFlag.Name) == node.DefaultDataDir():
log.Error("Inside datdir injection number two")
cfg.DataDir = pluginPath cfg.DataDir = pluginPath
// end PluGeth injection // end PluGeth injection
case ctx.IsSet(DataDirFlag.Name): case ctx.IsSet(DataDirFlag.Name):

View File

@ -22,7 +22,6 @@ func DefaultDataDir(pl *plugins.PluginLoader, path string) string {
} }
func pluginDefaultDataDir(path string) string { func pluginDefaultDataDir(path string) string {
log.Error("public default data dir")
if plugins.DefaultPluginLoader == nil { if plugins.DefaultPluginLoader == nil {
log.Warn("Attempting DefaultDataDir, but default PluginLoader has not been initialized") log.Warn("Attempting DefaultDataDir, but default PluginLoader has not been initialized")
return "" return ""