use os.UserHomeDir() to get user's home dir (#7288)
This commit is contained in:
parent
9544718d7e
commit
f413d3a5d0
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue