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

Method GetWorkingDir

pkg/ddevapp/ddevapp.go:3738–3753  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

3736// by consulting with the project configuration. If no dir is specified for the service, an
3737// empty string will be returned.
3738func (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
3756func (app *DdevApp) GetHostWorkingDir(service string, dir string) string {

Callers 3

RenderComposeYAMLMethod · 0.95
makeContainerCmdFunction · 0.80

Calls 1

DefaultWorkingDirMapMethod · 0.95

Tested by

no test coverage detected