aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2016-10-26 10:05:25 -0700
committerColin Cross <ccross@android.com>2016-10-27 15:18:17 -0700
commit4f6fc9c1d81687914cc77bf06b10af8022f64198 (patch)
tree906f75e4bf35257d17a00496c003280e99b438f0 /android
parent2f33635542b5fe97b6779cb2c6b3f5d2277c51b5 (diff)
downloadbuild_soong-4f6fc9c1d81687914cc77bf06b10af8022f64198.tar.gz
build_soong-4f6fc9c1d81687914cc77bf06b10af8022f64198.tar.bz2
build_soong-4f6fc9c1d81687914cc77bf06b10af8022f64198.zip
Add Path.Base helper
Add Path.Base to return the basename of a Path object. Test: builds Change-Id: I2bf1519dc5039bedb1586e7ec18297a293e32e11
Diffstat (limited to 'android')
-rw-r--r--android/paths.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/android/paths.go b/android/paths.go
index 35ed1801..56c3715f 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -79,8 +79,11 @@ type Path interface {
// 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 @@ func (p basePath) Ext() string {
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