Add Path.Base helper
Add Path.Base to return the basename of a Path object.
Test: builds
Change-Id: I2bf1519dc5039bedb1586e7ec18297a293e32e11
diff --git a/android/paths.go b/android/paths.go
index 35ed180..56c3715 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -79,8 +79,11 @@
// Returns the path in string form
String() string
- // Returns the current file extension of the path
+ // Ext returns the extension of the last element of the path
Ext() string
+
+ // Base returns the last element of the path
+ Base() string
}
// WritablePath is a type of path that can be used as an output for build rules.
@@ -284,6 +287,10 @@
return filepath.Ext(p.path)
}
+func (p basePath) Base() string {
+ return filepath.Base(p.path)
+}
+
// SourcePath is a Path representing a file path rooted from SrcDir
type SourcePath struct {
basePath