diff options
author | Ryan Mitchell <rtmitchell@google.com> | 2018-08-16 17:26:08 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-08-16 17:26:08 +0000 |
commit | ead275e19fc9ffbd751b3956a84e27844b97ffe7 (patch) | |
tree | f19915c04e52949cb29908ef1e0f6588ad98d766 /tools/aapt2/Source.h | |
parent | a60283fdd1f2c67259e8b0c10d88ecfb60a1328b (diff) | |
parent | f3649d669059b924ce9eb3eb7909cbf0a2ed31a8 (diff) |
Merge "AAPT2: Compile --zip flag"
Diffstat (limited to 'tools/aapt2/Source.h')
-rw-r--r-- | tools/aapt2/Source.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/aapt2/Source.h b/tools/aapt2/Source.h index 0f312d6998f1..92934c343960 100644 --- a/tools/aapt2/Source.h +++ b/tools/aapt2/Source.h @@ -31,12 +31,16 @@ namespace aapt { struct Source { std::string path; Maybe<size_t> line; + Maybe<std::string> archive; Source() = default; inline Source(const android::StringPiece& path) : path(path.to_string()) { // NOLINT(implicit) } + inline Source(const android::StringPiece& path, const android::StringPiece& archive) + : path(path.to_string()), archive(archive.to_string()) {} + inline Source(const android::StringPiece& path, size_t line) : path(path.to_string()), line(line) {} @@ -45,10 +49,14 @@ struct Source { } std::string to_string() const { + std::string s = path; + if (archive) { + s = ::android::base::StringPrintf("%s@%s", archive.value().c_str(), s.c_str()); + } if (line) { - return ::android::base::StringPrintf("%s:%zd", path.c_str(), line.value()); + s = ::android::base::StringPrintf("%s:%zd", s.c_str(), line.value()); } - return path; + return s; } }; |