docrootPrompt Determine the document root.
()
| 1547 | |
| 1548 | // docrootPrompt Determine the document root. |
| 1549 | func (app *DdevApp) docrootPrompt() error { |
| 1550 | // Determine the document root. |
| 1551 | output.UserOut.Printf("\nThe docroot is the directory from which your site is served.\nThis is a relative path from your project root at %s\n", app.AppRoot) |
| 1552 | output.UserOut.Printf("Leave docroot empty (hit <RETURN>) to use the location shown in parentheses.\nOr specify a custom path if your index.php is in a different directory.\nOr use '.' (a dot) to explicitly set it to the project root.\n") |
| 1553 | var docrootPrompt = "Docroot Location" |
| 1554 | var defaultDocroot = DiscoverDefaultDocroot(app) |
| 1555 | // If there is a default docroot, display it in the prompt. |
| 1556 | if defaultDocroot != "" { |
| 1557 | docrootPrompt = fmt.Sprintf("%s (%s)", docrootPrompt, defaultDocroot) |
| 1558 | } else { |
| 1559 | docrootPrompt = fmt.Sprintf("%s (project root)", docrootPrompt) |
| 1560 | } |
| 1561 | |
| 1562 | for { |
| 1563 | fmt.Print(docrootPrompt + ": ") |
| 1564 | app.Docroot = util.GetQuotedInput(defaultDocroot) |
| 1565 | |
| 1566 | // Ensure that the docroot exists |
| 1567 | if err := app.CreateDocroot(); err != nil { |
| 1568 | output.UserOut.Print(util.ColorizeText(err.Error(), "yellow")) |
| 1569 | } else { |
| 1570 | output.UserOut.Println() |
| 1571 | break |
| 1572 | } |
| 1573 | } |
| 1574 | |
| 1575 | return nil |
| 1576 | } |
| 1577 | |
| 1578 | // ConfigExists determines if a DDEV config file exists for this application. |
| 1579 | func (app *DdevApp) ConfigExists() bool { |
no test coverage detected