From 804e819c1bf64d4df483107e02e896b29e58b3f1 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Wed, 23 Aug 2023 02:22:53 +0000 Subject: Move String8 path functions to androidfw and aapt Test: m checkbuild Bug: 295394788 Change-Id: I9488bc5632cbd47c83f6b5f2df4c87eb324a1e8e --- tools/aapt/Command.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tools/aapt/Command.cpp') diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp index 60f3f2715395..800466aa587f 100644 --- a/tools/aapt/Command.cpp +++ b/tools/aapt/Command.cpp @@ -12,6 +12,7 @@ #include "ResourceTable.h" #include "XMLNode.h" +#include #include #include #include @@ -2486,12 +2487,12 @@ int doAdd(Bundle* bundle) for (int i = 1; i < bundle->getFileSpecCount(); i++) { const char* fileName = bundle->getFileSpecEntry(i); - if (strcasecmp(String8(fileName).getPathExtension().c_str(), ".gz") == 0) { + if (strcasecmp(getPathExtension(String8(fileName)).c_str(), ".gz") == 0) { printf(" '%s'... (from gzip)\n", fileName); - result = zip->addGzip(fileName, String8(fileName).getBasePath().c_str(), NULL); + result = zip->addGzip(fileName, getBasePath(String8(fileName)).c_str(), NULL); } else { if (bundle->getJunkPath()) { - String8 storageName = String8(fileName).getPathLeaf(); + String8 storageName = getPathLeaf(String8(fileName)); printf(" '%s' as '%s'...\n", fileName, ResTable::normalizeForOutput(storageName.c_str()).c_str()); result = zip->add(fileName, storageName.c_str(), @@ -2617,10 +2618,10 @@ static String8 buildApkName(const String8& original, const sp& split) return original; } - String8 ext(original.getPathExtension()); + String8 ext(getPathExtension(original)); if (ext == String8(".apk")) { return String8::format("%s_%s%s", - original.getBasePath().c_str(), + getBasePath(original).c_str(), split->getDirectorySafeName().c_str(), ext.c_str()); } @@ -2756,7 +2757,7 @@ int doPackage(Bundle* bundle) // generate the dependency file in the R.java package subdirectory // e.g. gen/com/foo/app/R.java.d dependencyFile = String8(bundle->getRClassDir()); - dependencyFile.appendPath("R.java.d"); + appendPath(dependencyFile, "R.java.d"); } // Make sure we have a clean dependency file to start with fp = fopen(dependencyFile, "w"); -- cgit v1.2.3-59-g8ed1b