summaryrefslogtreecommitdiffstats
path: root/runtime/dex_file.h
diff options
context:
space:
mode:
authorRichard Uhler <ruhler@google.com>2015-03-18 08:21:11 -0700
committerRichard Uhler <ruhler@google.com>2015-03-24 12:48:09 -0700
commite5fed03772144595c0904faf3d6974cc55214c8c (patch)
tree27c242e48cabd2543f472930d1ad7e2ab86557fe /runtime/dex_file.h
parentb93581f857e36a62f690e26e78167f2abea0f033 (diff)
downloadart-e5fed03772144595c0904faf3d6974cc55214c8c.zip
art-e5fed03772144595c0904faf3d6974cc55214c8c.tar.gz
art-e5fed03772144595c0904faf3d6974cc55214c8c.tar.bz2
Support relative encoded dex locations in oat files.
Now when opening an oat file, the caller can pass an absolute dex location used to resolve the absolute path for any relative encoded dex locations in the oat file. Bug: 19550105 Change-Id: I6e9559afe4d86ac12cf0b90176b5ea696a83d0e7
Diffstat (limited to 'runtime/dex_file.h')
-rw-r--r--runtime/dex_file.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/runtime/dex_file.h b/runtime/dex_file.h
index c8ede48..da39573 100644
--- a/runtime/dex_file.h
+++ b/runtime/dex_file.h
@@ -421,15 +421,26 @@ class DexFile {
}
}
- std::string GetBaseLocation() const {
- size_t pos = location_.rfind(kMultiDexSeparator);
+ static std::string GetBaseLocation(const std::string& location) {
+ return GetBaseLocation(location.c_str());
+ }
+
+ // Returns the ':classes*.dex' part of the dex location. Returns an empty
+ // string if there is no multidex suffix for the given location.
+ // The kMultiDexSeparator is included in the returned suffix.
+ static std::string GetMultiDexSuffix(const std::string& location) {
+ size_t pos = location.rfind(kMultiDexSeparator);
if (pos == std::string::npos) {
- return location_;
+ return "";
} else {
- return location_.substr(0, pos);
+ return location.substr(pos);
}
}
+ std::string GetBaseLocation() const {
+ return GetBaseLocation(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 {