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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user