GetWorkingDir will determine the appropriate working directory for an Exec/ExecWithTty command by consulting with the project configuration. If no dir is specified for the service, an empty string will be returned.
(service string, dir string)
| 3736 | // by consulting with the project configuration. If no dir is specified for the service, an |
| 3737 | // empty string will be returned. |
| 3738 | func (app *DdevApp) GetWorkingDir(service string, dir string) string { |
| 3739 | // Highest preference is for directories passed into the command directly |
| 3740 | if dir != "" { |
| 3741 | return dir |
| 3742 | } |
| 3743 | |
| 3744 | // The next highest preference is for directories defined in config.yaml |
| 3745 | if app.WorkingDir != nil { |
| 3746 | if workingDir := app.WorkingDir[service]; workingDir != "" { |
| 3747 | return workingDir |
| 3748 | } |
| 3749 | } |
| 3750 | |
| 3751 | // The next highest preference is for app type defaults |
| 3752 | return app.DefaultWorkingDirMap()[service] |
| 3753 | } |
| 3754 | |
| 3755 | // GetHostWorkingDir will determine the appropriate working directory for the service on the host side |
| 3756 | func (app *DdevApp) GetHostWorkingDir(service string, dir string) string { |
no test coverage detected