Skip to content

Commit 4293ac4

Browse files
committed
update home dir
1 parent ba316e6 commit 4293ac4

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

app/encoding.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package app
22

33
import (
4+
"math/rand"
45
"os"
6+
"path/filepath"
7+
"strconv"
58

69
"cosmossdk.io/client/v2/autocli"
710
"cosmossdk.io/core/appmodule"
@@ -20,7 +23,7 @@ import (
2023

2124
// MakeEncodingConfig creates an EncodingConfig for testing
2225
func MakeEncodingConfig() params.EncodingConfig {
23-
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: os.TempDir()})
26+
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, NewEmptyAppOptions())
2427
encodingConfig := params.EncodingConfig{
2528
InterfaceRegistry: tempApp.InterfaceRegistry(),
2629
Codec: tempApp.AppCodec(),
@@ -32,7 +35,7 @@ func MakeEncodingConfig() params.EncodingConfig {
3235
}
3336

3437
func AutoCliOpts() autocli.AppOptions {
35-
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: os.TempDir()})
38+
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, NewEmptyAppOptions())
3639
modules := make(map[string]appmodule.AppModule, 0)
3740
for _, m := range tempApp.ModuleManager.Modules {
3841
if moduleWithName, ok := m.(module.HasName); ok {
@@ -53,7 +56,7 @@ func AutoCliOpts() autocli.AppOptions {
5356
}
5457

5558
func BasicManager() module.BasicManager {
56-
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, EmptyAppOptions{homeDir: os.TempDir()})
59+
tempApp := NewMinitiaApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, []wasmkeeper.Option{}, NewEmptyAppOptions())
5760
return tempApp.BasicModuleManager
5861
}
5962

@@ -62,6 +65,12 @@ type EmptyAppOptions struct {
6265
homeDir string
6366
}
6467

68+
func NewEmptyAppOptions() EmptyAppOptions {
69+
return EmptyAppOptions{
70+
homeDir: filepath.Join(os.TempDir(), strconv.Itoa(rand.Int())),
71+
}
72+
}
73+
6574
// Get implements AppOptions
6675
func (ao EmptyAppOptions) Get(o string) interface{} {
6776
if o == flags.FlagHome {

0 commit comments

Comments
 (0)