Use common method to determine file existence
This commit is contained in:
parent
45d07a3d0b
commit
879b4c0a2c
|
@ -5,7 +5,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
|
||||||
|
|
||||||
crypto "github.com/tendermint/go-crypto"
|
crypto "github.com/tendermint/go-crypto"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
|
@ -144,7 +143,7 @@ func LoadPrivValidatorJSON(filePath string) *PrivValidatorJSON {
|
||||||
// or else generates a new one and saves it to the filePath.
|
// or else generates a new one and saves it to the filePath.
|
||||||
func LoadOrGenPrivValidatorJSON(filePath string) *PrivValidatorJSON {
|
func LoadOrGenPrivValidatorJSON(filePath string) *PrivValidatorJSON {
|
||||||
var pvj *PrivValidatorJSON
|
var pvj *PrivValidatorJSON
|
||||||
if _, err := os.Stat(filePath); err == nil {
|
if cmn.FileExists(filePath) {
|
||||||
pvj = LoadPrivValidatorJSON(filePath)
|
pvj = LoadPrivValidatorJSON(filePath)
|
||||||
} else {
|
} else {
|
||||||
pvj = GenPrivValidatorJSON(filePath)
|
pvj = GenPrivValidatorJSON(filePath)
|
||||||
|
|
Loading…
Reference in New Issue