Add OptionalPath.RelativeToTop
Needed for some follow up changes. Bug: 183650682 Test: m nothing Change-Id: If38dfe8e919094a7365bcee6cb71bfd0409f4454
This commit is contained in:
parent
29888b1bf0
commit
a5b8135bdf
1 changed files with 10 additions and 0 deletions
|
@ -286,6 +286,16 @@ func (p OptionalPath) Path() Path {
|
|||
return p.path
|
||||
}
|
||||
|
||||
// RelativeToPath returns an OptionalPath with the path that was embedded having been replaced by
|
||||
// the result of calling Path.RelativeToPath on it.
|
||||
func (p OptionalPath) RelativeToPath() OptionalPath {
|
||||
if !p.valid {
|
||||
return p
|
||||
}
|
||||
p.path = p.path.RelativeToTop()
|
||||
return p
|
||||
}
|
||||
|
||||
// String returns the string version of the Path, or "" if it isn't valid.
|
||||
func (p OptionalPath) String() string {
|
||||
if p.valid {
|
||||
|
|
Loading…
Reference in a new issue