summaryrefslogtreecommitdiffstats
path: root/runtime/dex_file.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/dex_file.h')
-rw-r--r--runtime/dex_file.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/runtime/dex_file.h b/runtime/dex_file.h
index 04f1cc1417..d64a030051 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -382,6 +382,20 @@ class DexFile {
return location_;
}
+ // For normal dex files, location and base location coincide. If a dex file is part of a multidex
+ // archive, the base location is the name of the originating jar/apk, stripped of any internal
+ // classes*.dex path.
+ const std::string GetBaseLocation() const {
+ if (IsMultiDexLocation(location_.c_str())) {
+ std::pair<const char*, const char*> pair = SplitMultiDexLocation(location_.c_str());
+ std::string res(pair.first);
+ delete[] pair.first;
+ return res;
+ } else {
+ return location_;
+ }
+ }
+
// For DexFiles directly from .dex files, this is the checksum from the DexFile::Header.
// For DexFiles opened from a zip files, this will be the ZipEntry CRC32 of classes.dex.
uint32_t GetLocationChecksum() const {