File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,9 +50,16 @@ import (
5050 "github.com/xrplevm/node/v10/app"
5151)
5252
53- type emptyAppOptions struct {}
54-
55- func (ao emptyAppOptions ) Get (_ string ) interface {} { return nil }
53+ type tmpAppOptions struct {}
54+
55+ func (ao tmpAppOptions ) Get (searchFlag string ) interface {} {
56+ switch searchFlag {
57+ case flags .FlagHome :
58+ return tempDir (app .DefaultNodeHome )
59+ default :
60+ return nil
61+ }
62+ }
5663
5764// NewRootCmd creates a new root command for a Cosmos SDK application
5865func NewRootCmd () (* cobra.Command , sdktestutil.TestEncodingConfig ) {
@@ -64,7 +71,7 @@ func NewRootCmd() (*cobra.Command, sdktestutil.TestEncodingConfig) {
6471 dbm .NewMemDB (),
6572 nil , true , nil ,
6673 0 ,
67- emptyAppOptions {},
74+ tmpAppOptions {},
6875 )
6976 encodingConfig := sdktestutil.TestEncodingConfig {
7077 InterfaceRegistry : tempApp .InterfaceRegistry (),
@@ -424,3 +431,13 @@ func getChainIDFromOpts(appOpts servertypes.AppOptions) (chainID string, err err
424431
425432 return
426433}
434+
435+ func tempDir (defaultHome string ) string {
436+ dir , err := os .MkdirTemp ("" , ".exrpd-tmp" )
437+ if err != nil {
438+ dir = defaultHome
439+ }
440+ defer os .RemoveAll (dir )
441+
442+ return dir
443+ }
You can’t perform that action at this time.
0 commit comments