Create the home directory if it doesn't exist.
This commit is contained in:
parent
9643cb6d23
commit
0301690499
1 changed files with 8 additions and 1 deletions
|
@ -49,6 +49,13 @@ func loadConfig() (*flags.Parser, *config, []string, error) {
|
||||||
RPCCert: defaultRPCCertFile,
|
RPCCert: defaultRPCCertFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create the home directory if it doesn't already exist.
|
||||||
|
err := os.MkdirAll(btcdHomeDir, 0700)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
// Pre-parse the command line options to see if an alternative config
|
// Pre-parse the command line options to see if an alternative config
|
||||||
// file or the version flag was specified. Any errors can be ignored
|
// file or the version flag was specified. Any errors can be ignored
|
||||||
// here since they will be caught be the final parse below.
|
// here since they will be caught be the final parse below.
|
||||||
|
@ -66,7 +73,7 @@ func loadConfig() (*flags.Parser, *config, []string, error) {
|
||||||
|
|
||||||
// Load additional config from file.
|
// Load additional config from file.
|
||||||
parser := flags.NewParser(&cfg, flags.PassDoubleDash|flags.HelpFlag)
|
parser := flags.NewParser(&cfg, flags.PassDoubleDash|flags.HelpFlag)
|
||||||
err := parser.ParseIniFile(preCfg.ConfigFile)
|
err = parser.ParseIniFile(preCfg.ConfigFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, ok := err.(*os.PathError); !ok {
|
if _, ok := err.(*os.PathError); !ok {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
|
Loading…
Reference in a new issue