client: always create alloc dir if it is non-empty

This commit is contained in:
Ryan Uber 2015-09-13 12:14:12 -07:00
parent 0e38f0e914
commit 3d31230ac1
1 changed files with 5 additions and 7 deletions

View File

@ -131,13 +131,11 @@ func NewClient(cfg *config.Config) (*Client, error) {
// init is used to initialize the client and perform any setup
// needed before we begin starting its various components.
func (c *Client) init() error {
if c.config.DevMode {
return nil
}
// Ensure the alloc dir exists
if err := os.MkdirAll(c.config.AllocDir, 0700); err != nil {
return fmt.Errorf("failed creating alloc dir: %s", err)
// Ensure the alloc dir exists if we have one
if c.config.AllocDir != "" {
if err := os.MkdirAll(c.config.AllocDir, 0700); err != nil {
return fmt.Errorf("failed creating alloc dir: %s", err)
}
}
return nil
}