feat: create the wallets directory
This commit is contained in:
parent
18f944b4d9
commit
c91e650d53
2 changed files with 18 additions and 8 deletions
|
@ -14,6 +14,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
|||
- Print the expiration time of TOTP code
|
||||
- Export a wallet in json
|
||||
- Import entries from a json file
|
||||
- Create the wallets directory
|
||||
|
||||
## Changed
|
||||
|
||||
|
|
|
@ -58,20 +58,29 @@ func (c *Config) Init() error {
|
|||
|
||||
// Load the configuration from a file
|
||||
func (c *Config) Load(path string) error {
|
||||
_, err := os.Stat(path)
|
||||
err := c.Init()
|
||||
if err != nil {
|
||||
err = c.Init()
|
||||
return err
|
||||
}
|
||||
|
||||
if path != "" {
|
||||
_, err = os.Stat(path)
|
||||
if err != nil {
|
||||
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(data, &c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
data, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(data, &c)
|
||||
err = os.MkdirAll(c.WalletDir, 0700)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue