From dbe7a68cc13ae135b33769918932838d2d447169 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Fri, 9 Oct 2009 11:24:51 -0700 Subject: 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. --- tools/aapt/Command.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'tools/aapt/Command.cpp') 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); -- cgit v1.2.3-59-g8ed1b