Properly mangle file names
Change-Id: I49c0f82e8c06f056198eb64b8369d83403b74321
diff --git a/tools/aapt2/ZipEntry.cpp b/tools/aapt2/ZipEntry.cpp
index ad5d84a..891b4e1 100644
--- a/tools/aapt2/ZipEntry.cpp
+++ b/tools/aapt2/ZipEntry.cpp
@@ -144,9 +144,15 @@
* Initializes the CDE and the LFH.
*/
status_t ZipEntry::initFromExternal(const ZipFile* /* pZipFile */,
- const ZipEntry* pEntry)
+ const ZipEntry* pEntry, const char* storageName)
{
mCDE = pEntry->mCDE;
+ if (storageName && *storageName != 0) {
+ mCDE.mFileNameLength = strlen(storageName);
+ mCDE.mFileName = new unsigned char[mCDE.mFileNameLength + 1];
+ strcpy((char*) mCDE.mFileName, storageName);
+ }
+
// Check whether we got all the memory needed.
if ((mCDE.mFileNameLength > 0 && mCDE.mFileName == NULL) ||
(mCDE.mFileCommentLength > 0 && mCDE.mFileComment == NULL) ||