diff options
Diffstat (limited to 'libartbase/base/file_utils.cc')
-rw-r--r-- | libartbase/base/file_utils.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libartbase/base/file_utils.cc b/libartbase/base/file_utils.cc index 8159b0cf66..bc08f309bb 100644 --- a/libartbase/base/file_utils.cc +++ b/libartbase/base/file_utils.cc @@ -661,6 +661,18 @@ bool LocationIsOnApex(std::string_view full_path) { return android::base::StartsWith(full_path, kApexDefaultPath); } +std::string_view ApexNameFromLocation(std::string_view full_path) { + if (!android::base::StartsWith(full_path, kApexDefaultPath)) { + return {}; + } + size_t start = strlen(kApexDefaultPath); + size_t end = full_path.find('/', start); + if (end == std::string_view::npos) { + return {}; + } + return full_path.substr(start, end - start); +} + bool LocationIsOnSystem(const std::string& location) { #ifdef _WIN32 UNUSED(location); |