Fix Rel() after ReplaceExtension or InSameDir
Copying p.rel doesn't work, as rel needs to match the end of the
value in path. Apply the same transformation to p.rel as p.path.
Test: paths_test.go
Change-Id: I42d676c6c4fc18d9852c1a73f25e5a791d7553d0
diff --git a/android/paths.go b/android/paths.go
index 3366db1..afde55e 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -712,7 +712,7 @@
reportPathErrorf(ctx, "extension %q cannot contain /", ext)
}
ret := PathForOutput(ctx, pathtools.ReplaceExtension(p.path, ext))
- ret.rel = p.rel
+ ret.rel = pathtools.ReplaceExtension(p.rel, ext)
return ret
}
@@ -724,7 +724,7 @@
}
ret := PathForOutput(ctx, filepath.Dir(p.path), path)
- ret.rel = p.rel
+ ret.rel = filepath.Join(filepath.Dir(p.rel), path)
return ret
}