Add DataPath.ToRelativeInstallPath

Add a method to DataPath that converts it to the relative install path
in preparation for adding additional complexity to DataPath.

Bug: 311428265
Test: builds
Change-Id: I65b06238aafda2db72c6a253744a3087976451cd
This commit is contained in:
Colin Cross
2023-11-16 11:19:26 -08:00
parent 09ad3a6505
commit d442a0e882
2 changed files with 12 additions and 8 deletions

View File

@@ -2210,6 +2210,14 @@ type DataPath struct {
RelativeInstallPath string
}
func (d *DataPath) ToRelativeInstallPath() string {
relPath := d.SrcPath.Rel()
if d.RelativeInstallPath != "" {
relPath = filepath.Join(d.RelativeInstallPath, relPath)
}
return relPath
}
// PathsIfNonNil returns a Paths containing only the non-nil input arguments.
func PathsIfNonNil(paths ...Path) Paths {
if len(paths) == 0 {