summaryrefslogtreecommitdiff
path: root/tools/aapt/Command.cpp
diff options
context:
space:
mode:
author Doug Zongker <dougz@android.com> 2009-10-09 11:24:51 -0700
committer Doug Zongker <dougz@android.com> 2009-10-13 13:33:31 -0700
commitdbe7a68cc13ae135b33769918932838d2d447169 (patch)
tree325051b0f903da2157f6c511a5b8f6608592851a /tools/aapt/Command.cpp
parent2d295a9601315a2610a2cb759ed9a4f787e7d4b5 (diff)
add "junk path" -k option to aapt
Adds a "junk path" option to aapt so that you can do: aapt add -k archive.zip path/to/some.file and have the file stored in the zip under the name "some.file" (without the path). Needed so that we can use 'aapt add' in place of 'zip -j' when building jar files, which will lead to smaller incremental OTAs.
Diffstat (limited to 'tools/aapt/Command.cpp')
-rw-r--r--tools/aapt/Command.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 47423418e8b2..1a536d6a8085 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -848,7 +848,7 @@ int doDump(Bundle* bundle)
printf("uses-feature:'android.hardware.camera'\n");
printf("uses-feature:'android.hardware.camera.autofocus'\n");
}
-
+
if (hasMainActivity) {
printf("main\n");
}
@@ -997,8 +997,15 @@ int doAdd(Bundle* bundle)
printf(" '%s'... (from gzip)\n", fileName);
result = zip->addGzip(fileName, String8(fileName).getBasePath().string(), NULL);
} else {
- printf(" '%s'...\n", fileName);
- result = zip->add(fileName, bundle->getCompressionMethod(), NULL);
+ if (bundle->getJunkPath()) {
+ String8 storageName = String8(fileName).getPathLeaf();
+ printf(" '%s' as '%s'...\n", fileName, storageName.string());
+ result = zip->add(fileName, storageName.string(),
+ bundle->getCompressionMethod(), NULL);
+ } else {
+ printf(" '%s'...\n", fileName);
+ result = zip->add(fileName, bundle->getCompressionMethod(), NULL);
+ }
}
if (result != NO_ERROR) {
fprintf(stderr, "Unable to add '%s' to '%s'", bundle->getFileSpecEntry(i), zipFileName);