diff options
Diffstat (limited to 'tools/aapt2/Files.cpp')
-rw-r--r-- | tools/aapt2/Files.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/aapt2/Files.cpp b/tools/aapt2/Files.cpp index 349abbd236f1..8484148f29d3 100644 --- a/tools/aapt2/Files.cpp +++ b/tools/aapt2/Files.cpp @@ -105,6 +105,17 @@ bool mkdirs(const StringPiece& path) { return mkdirImpl(path) == 0 || errno == EEXIST; } +std::string getStem(const StringPiece& path) { + const char* start = path.begin(); + const char* end = path.end(); + for (const char* current = end - 1; current != start - 1; --current) { + if (*current == sDirSep) { + return std::string(start, current - start); + } + } + return {}; +} + bool FileFilter::setPattern(const StringPiece& pattern) { mPatternTokens = util::splitAndLowercase(pattern, ':'); return true; |