GetRelativeDirectory returns the directory relative to project root Note that the relative dir is returned as unix-style forward-slashes
(targetPath string)
| 502 | // GetRelativeDirectory returns the directory relative to project root |
| 503 | // Note that the relative dir is returned as unix-style forward-slashes |
| 504 | func (app *DdevApp) GetRelativeDirectory(targetPath string) string { |
| 505 | // Find the relative dir |
| 506 | relativeWorkingDir := strings.TrimPrefix(targetPath, app.AppRoot) |
| 507 | // Convert to slash/linux/macos notation, should work everywhere |
| 508 | relativeWorkingDir = filepath.ToSlash(relativeWorkingDir) |
| 509 | // Remove any leading / |
| 510 | relativeWorkingDir = strings.TrimLeft(relativeWorkingDir, "/") |
| 511 | |
| 512 | return relativeWorkingDir |
| 513 | } |
| 514 | |
| 515 | // GetRelativeWorkingDirectory returns the relative working directory relative to project root |
| 516 | // Note that the relative dir is returned as unix-style forward-slashes |
no outgoing calls
no test coverage detected