MCPcopy Index your code
hub / github.com/ddev/ddev / CreateDocroot

Method CreateDocroot

pkg/ddevapp/config.go:1512–1527  ·  view source on GitHub ↗

CreateDocroot creates the docroot for the project if it doesn't exist

()

Source from the content-addressed store, hash-verified

1510
1511// CreateDocroot creates the docroot for the project if it doesn't exist
1512func (app *DdevApp) CreateDocroot() error {
1513 if app.GetDocroot() == "" {
1514 return nil
1515 }
1516 if err := ValidateDocroot(app.GetDocroot()); err != nil {
1517 return err
1518 }
1519 docrootAbsPath := app.GetAbsDocroot(false)
1520 if !fileutil.IsDirectory(docrootAbsPath) {
1521 if err := os.MkdirAll(docrootAbsPath, 0755); err != nil {
1522 return err
1523 }
1524 util.Success("Created docroot at %s", docrootAbsPath)
1525 }
1526 return nil
1527}
1528
1529// DiscoverDefaultDocroot returns the default docroot directory.
1530func DiscoverDefaultDocroot(app *DdevApp) string {

Callers 4

docrootPromptMethod · 0.95
prepareAppForComposerFunction · 0.80
handleMainConfigArgsFunction · 0.80

Calls 5

GetDocrootMethod · 0.95
GetAbsDocrootMethod · 0.95
IsDirectoryFunction · 0.92
SuccessFunction · 0.92
ValidateDocrootFunction · 0.85

Tested by

no test coverage detected