use os.UserHomeDir() to get user's home dir (#7288)

This commit is contained in:
Alessio Treglia 2020-09-13 12:18:02 +01:00 committed by GitHub
parent 9544718d7e
commit f413d3a5d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package simapp
import (
"io"
"os"
"path/filepath"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
@ -82,7 +83,7 @@ const appName = "SimApp"
var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome = os.ExpandEnv("$HOME/.simapp")
DefaultNodeHome string
// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
@ -170,6 +171,15 @@ type SimApp struct {
sm *module.SimulationManager
}
func init() {
userHomeDir, err := os.UserHomeDir()
if err != nil {
panic(err)
}
DefaultNodeHome = filepath.Join(userHomeDir, ".simapp")
}
// NewSimApp returns a reference to an initialized SimApp.
func NewSimApp(
logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool,