Skip to content

Commit

Permalink
Make sure that ~/.ddev exists very early
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Jul 6, 2017
1 parent 1adb9c3 commit 4ed2c6f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/ddev/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,19 @@ var RootCmd = &cobra.Command{
}
}

usr, err := homedir.Dir()
homedir, err := homedir.Dir()
if err != nil {
util.Failed("Could not detect user's home directory: ", err)
}

updateFile := filepath.Join(usr, ".ddev", ".update")
// Verify that the ~/.ddev exists
homeddev := filepath.Join(homedir, ".ddev")
if _, err := os.Stat(homeddev); os.IsNotExist(err) {
err = os.MkdirAll(homeddev, 0700)
util.Failed("Failed to create required directory %s, err: %v", homeddev, err)
}

updateFile := filepath.Join(homeddev, ".update")
// Do periodic detection of whether an update is available for ddev users.
timeToCheckForUpdates, err := updatecheck.IsUpdateNeeded(updateFile, updateInterval)
if err != nil {
Expand Down

0 comments on commit 4ed2c6f

Please sign in to comment.