Add Path.Base helper am: 4f6fc9c1d8 am: 656028558b

am: 311afec662

Change-Id: I8cc715db736de27d49f855b764149a37f953724d
This commit is contained in:
Colin Cross
2016-10-28 20:20:11 +00:00
committed by android-build-merger

View File

@@ -79,8 +79,11 @@ type Path interface {
// Returns the path in string form // Returns the path in string form
String() string String() string
// Returns the current file extension of the path // Ext returns the extension of the last element of the path
Ext() string 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. // 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) 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 // SourcePath is a Path representing a file path rooted from SrcDir
type SourcePath struct { type SourcePath struct {
basePath basePath