Skip to content

Commit

Permalink
fix: make ddev --version work even if not in project and ~/.ddev/co…
Browse files Browse the repository at this point in the history
…mmands not yet created (#5854) [skip ci]
  • Loading branch information
rfay committed Feb 17, 2024
1 parent c7ae1b6 commit ca7e2ab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/ddevapp/assets.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package ddevapp

import (
"embed"
"github.com/ddev/ddev/pkg/globalconfig"
"path/filepath"

"github.com/ddev/ddev/pkg/fileutil"
"github.com/ddev/ddev/pkg/globalconfig"
)

// The bundled assets for the project .ddev directory are in directory dotddev_assets
Expand Down Expand Up @@ -36,6 +36,12 @@ var bundledAssets embed.FS
// directory's assets (if it's a project) and then later (when called with appName) update
// the actual project's assets.
func PopulateExamplesCommandsHomeadditions(appName string) error {

err := fileutil.CopyEmbedAssets(bundledAssets, "global_dotddev_assets", globalconfig.GetGlobalDdevDir())
if err != nil {
return err
}

app, err := GetActiveApp(appName)
// If we have an error from GetActiveApp, it means we're not in a project directory
// That is not an error. It means we can not do this work, so return nil.
Expand All @@ -47,10 +53,6 @@ func PopulateExamplesCommandsHomeadditions(appName string) error {
if err != nil {
return err
}
err = fileutil.CopyEmbedAssets(bundledAssets, "global_dotddev_assets", globalconfig.GetGlobalDdevDir())
if err != nil {
return err
}

return nil
}
Expand Down

0 comments on commit ca7e2ab

Please sign in to comment.