diff options
Diffstat (limited to 'shared/paths.go')
-rw-r--r-- | shared/paths.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/shared/paths.go b/shared/paths.go index 1b9ff6098..fca8b4c15 100644 --- a/shared/paths.go +++ b/shared/paths.go @@ -30,6 +30,21 @@ type SharedPaths interface { BazelMetricsDir() string } +// Joins the path strings in the argument list, taking absolute paths into +// account. That is, if one of the strings is an absolute path, the ones before +// are ignored. +func JoinPath(base string, rest ...string) string { + result := base + for _, next := range rest { + if filepath.IsAbs(next) { + result = next + } else { + result = filepath.Join(result, next) + } + } + return result +} + // Given the out directory, returns the root of the temp directory (to be cleared at the start of each execution of Soong) func TempDirForOutDir(outDir string) (tempPath string) { return filepath.Join(outDir, ".temp") |